QuoteStrategy.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\ORM\Mapping;
  20. use Doctrine\ORM\Mapping\ClassMetadata;
  21. use Doctrine\DBAL\Platforms\AbstractPlatform;
  22. /**
  23. * A set of rules for determining the column, alias and table quotes
  24. *
  25. * @since 2.3
  26. * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
  27. */
  28. interface QuoteStrategy
  29. {
  30. /**
  31. * Gets the (possibly quoted) column name for safe use in an SQL statement.
  32. *
  33. * @param string $fieldName
  34. * @param ClassMetadata $class
  35. * @param AbstractPlatform $platform
  36. * @return string
  37. */
  38. function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
  39. /**
  40. * Gets the (possibly quoted) primary table name for safe use in an SQL statement.
  41. *
  42. * @param ClassMetadata $class
  43. * @param AbstractPlatform $platform
  44. * @return string
  45. */
  46. function getTableName(ClassMetadata $class, AbstractPlatform $platform);
  47. /**
  48. * Gets the (possibly quoted) sequence name for safe use in an SQL statement.
  49. *
  50. * @param array $definition
  51. * @param ClassMetadata $class
  52. * @param AbstractPlatform $platform
  53. * @return string
  54. */
  55. function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
  56. /**
  57. * Gets the (possibly quoted) name of the join table.
  58. *
  59. * @param array $association
  60. * @param ClassMetadata $class
  61. * @param AbstractPlatform $platform
  62. * @return string
  63. */
  64. function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
  65. /**
  66. * Gets the (possibly quoted) join column name.
  67. *
  68. * @param array $joinColumn
  69. * @param ClassMetadata $class
  70. * @param AbstractPlatform $platform
  71. * @return string
  72. */
  73. function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
  74. /**
  75. * Gets the (possibly quoted) join column name.
  76. *
  77. * @param array $joinColumn
  78. * @param ClassMetadata $class
  79. * @param AbstractPlatform $platform
  80. * @return string
  81. */
  82. function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
  83. /**
  84. * Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
  85. *
  86. * @param ClassMetadata $class
  87. * @param AbstractPlatform $platform
  88. * @return array
  89. */
  90. function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
  91. /**
  92. * Gets the column alias.
  93. *
  94. * @param string $columnName
  95. * @param integer $counter
  96. * @param AbstractPlatform $platform
  97. * @param ClassMetadata $class
  98. * @return string
  99. */
  100. function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);
  101. }