QuoteStrategy.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. *
  37. * @return string
  38. */
  39. function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
  40. /**
  41. * Gets the (possibly quoted) primary table name for safe use in an SQL statement.
  42. *
  43. * @param ClassMetadata $class
  44. * @param AbstractPlatform $platform
  45. *
  46. * @return string
  47. */
  48. function getTableName(ClassMetadata $class, AbstractPlatform $platform);
  49. /**
  50. * Gets the (possibly quoted) sequence name for safe use in an SQL statement.
  51. *
  52. * @param array $definition
  53. * @param ClassMetadata $class
  54. * @param AbstractPlatform $platform
  55. *
  56. * @return string
  57. */
  58. function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
  59. /**
  60. * Gets the (possibly quoted) name of the join table.
  61. *
  62. * @param array $association
  63. * @param ClassMetadata $class
  64. * @param AbstractPlatform $platform
  65. *
  66. * @return string
  67. */
  68. function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
  69. /**
  70. * Gets the (possibly quoted) join column name.
  71. *
  72. * @param array $joinColumn
  73. * @param ClassMetadata $class
  74. * @param AbstractPlatform $platform
  75. *
  76. * @return string
  77. */
  78. function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
  79. /**
  80. * Gets the (possibly quoted) join column name.
  81. *
  82. * @param array $joinColumn
  83. * @param ClassMetadata $class
  84. * @param AbstractPlatform $platform
  85. *
  86. * @return string
  87. */
  88. function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
  89. /**
  90. * Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
  91. *
  92. * @param ClassMetadata $class
  93. * @param AbstractPlatform $platform
  94. *
  95. * @return array
  96. */
  97. function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
  98. /**
  99. * Gets the column alias.
  100. *
  101. * @param string $columnName
  102. * @param integer $counter
  103. * @param AbstractPlatform $platform
  104. * @param ClassMetadata|null $class
  105. *
  106. * @return string
  107. */
  108. function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);
  109. }