NamingStrategy.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. /**
  21. * A set of rules for determining the physical column and table names
  22. *
  23. * @link www.doctrine-project.org
  24. */
  25. interface NamingStrategy
  26. {
  27. /**
  28. * Returns a table name for an entity class.
  29. *
  30. * @param string $className The fully-qualified class name.
  31. *
  32. * @return string A table name.
  33. */
  34. public function classToTableName($className);
  35. /**
  36. * Returns a column name for a property.
  37. *
  38. * @param string $propertyName A property name.
  39. * @param string|null $className The fully-qualified class name.
  40. *
  41. * @return string A column name.
  42. */
  43. public function propertyToColumnName($propertyName, $className = null);
  44. /**
  45. * Returns a column name for an embedded property.
  46. *
  47. * @param string $propertyName
  48. * @param string $embeddedColumnName
  49. * @param string $className
  50. * @param string $embeddedClassName
  51. *
  52. * @return string
  53. */
  54. public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null);
  55. /**
  56. * Returns the default reference column name.
  57. *
  58. * @return string A column name.
  59. */
  60. public function referenceColumnName();
  61. /**
  62. * Returns a join column name for a property.
  63. *
  64. * @param string $propertyName A property name.
  65. *
  66. * @return string A join column name.
  67. */
  68. public function joinColumnName($propertyName);
  69. /**
  70. * Returns a join table name.
  71. *
  72. * @param string $sourceEntity The source entity.
  73. * @param string $targetEntity The target entity.
  74. * @param string|null $propertyName A property name.
  75. *
  76. * @return string A join table name.
  77. */
  78. public function joinTableName($sourceEntity, $targetEntity, $propertyName = null);
  79. /**
  80. * Returns the foreign key column name for the given parameters.
  81. *
  82. * @param string $entityName An entity.
  83. * @param string|null $referencedColumnName A property.
  84. *
  85. * @return string A join column name.
  86. */
  87. public function joinKeyColumnName($entityName, $referencedColumnName = null);
  88. }