QuoteStrategy.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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\DBAL\Platforms\AbstractPlatform;
  21. /**
  22. * A set of rules for determining the column, alias and table quotes.
  23. */
  24. interface QuoteStrategy
  25. {
  26. /**
  27. * Gets the (possibly quoted) column name for safe use in an SQL statement.
  28. *
  29. * @param string $fieldName
  30. *
  31. * @return string
  32. */
  33. public function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
  34. /**
  35. * Gets the (possibly quoted) primary table name for safe use in an SQL statement.
  36. *
  37. * @return string
  38. */
  39. public function getTableName(ClassMetadata $class, AbstractPlatform $platform);
  40. /**
  41. * Gets the (possibly quoted) sequence name for safe use in an SQL statement.
  42. *
  43. * @param mixed[] $definition
  44. *
  45. * @return string
  46. */
  47. public function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
  48. /**
  49. * Gets the (possibly quoted) name of the join table.
  50. *
  51. * @param mixed[] $association
  52. *
  53. * @return string
  54. */
  55. public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
  56. /**
  57. * Gets the (possibly quoted) join column name.
  58. *
  59. * @param mixed[] $joinColumn
  60. *
  61. * @return string
  62. */
  63. public function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
  64. /**
  65. * Gets the (possibly quoted) join column name.
  66. *
  67. * @param mixed[] $joinColumn
  68. *
  69. * @return string
  70. */
  71. public function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
  72. /**
  73. * Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
  74. *
  75. * @psalm-return list<string>
  76. */
  77. public function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
  78. /**
  79. * Gets the column alias.
  80. *
  81. * @param string $columnName
  82. * @param int $counter
  83. *
  84. * @return string
  85. */
  86. public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ?ClassMetadata $class = null);
  87. }