NamingStrategy.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. *
  24. * @link www.doctrine-project.org
  25. * @since 2.3
  26. * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
  27. */
  28. interface NamingStrategy
  29. {
  30. /**
  31. * Return a table name for an entity class
  32. *
  33. * @param string $className The fully-qualified class name
  34. * @return string A table name
  35. */
  36. function classToTableName($className);
  37. /**
  38. * Return a column name for a property
  39. *
  40. * @param string $propertyName A property
  41. * @return string A column name
  42. */
  43. function propertyToColumnName($propertyName);
  44. /**
  45. * Return the default reference column name
  46. *
  47. * @return string A column name
  48. */
  49. function referenceColumnName();
  50. /**
  51. * Return a join column name for a property
  52. *
  53. * @param string $propertyName A property
  54. * @return string A join column name
  55. */
  56. function joinColumnName($propertyName);
  57. /**
  58. * Return a join table name
  59. *
  60. * @param string $sourceEntity The source entity
  61. * @param string $targetEntity The target entity
  62. * @param string $propertyName A property
  63. * @return string A join table name
  64. */
  65. function joinTableName($sourceEntity, $targetEntity, $propertyName = null);
  66. /**
  67. * Return the foreign key column name for the given parameters
  68. *
  69. * @param string $entityName A entity
  70. * @param string $referencedColumnName A property
  71. * @return string A join column name
  72. */
  73. function joinKeyColumnName($entityName, $referencedColumnName = null);
  74. }