ClassMetadata.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. namespace Doctrine\Persistence\Mapping;
  3. use ReflectionClass;
  4. /**
  5. * Contract for a Doctrine persistence layer ClassMetadata class to implement.
  6. */
  7. interface ClassMetadata
  8. {
  9. /**
  10. * Gets the fully-qualified class name of this persistent class.
  11. *
  12. * @return string
  13. */
  14. public function getName();
  15. /**
  16. * Gets the mapped identifier field name.
  17. *
  18. * The returned structure is an array of the identifier field names.
  19. *
  20. * @return mixed[]
  21. */
  22. public function getIdentifier();
  23. /**
  24. * Gets the ReflectionClass instance for this mapped class.
  25. *
  26. * @return ReflectionClass
  27. */
  28. public function getReflectionClass();
  29. /**
  30. * Checks if the given field name is a mapped identifier for this class.
  31. *
  32. * @param string $fieldName
  33. *
  34. * @return bool
  35. */
  36. public function isIdentifier($fieldName);
  37. /**
  38. * Checks if the given field is a mapped property for this class.
  39. *
  40. * @param string $fieldName
  41. *
  42. * @return bool
  43. */
  44. public function hasField($fieldName);
  45. /**
  46. * Checks if the given field is a mapped association for this class.
  47. *
  48. * @param string $fieldName
  49. *
  50. * @return bool
  51. */
  52. public function hasAssociation($fieldName);
  53. /**
  54. * Checks if the given field is a mapped single valued association for this class.
  55. *
  56. * @param string $fieldName
  57. *
  58. * @return bool
  59. */
  60. public function isSingleValuedAssociation($fieldName);
  61. /**
  62. * Checks if the given field is a mapped collection valued association for this class.
  63. *
  64. * @param string $fieldName
  65. *
  66. * @return bool
  67. */
  68. public function isCollectionValuedAssociation($fieldName);
  69. /**
  70. * A numerically indexed list of field names of this persistent class.
  71. *
  72. * This array includes identifier fields if present on this class.
  73. *
  74. * @return string[]
  75. */
  76. public function getFieldNames();
  77. /**
  78. * Returns an array of identifier field names numerically indexed.
  79. *
  80. * @return string[]
  81. */
  82. public function getIdentifierFieldNames();
  83. /**
  84. * Returns a numerically indexed list of association names of this persistent class.
  85. *
  86. * This array includes identifier associations if present on this class.
  87. *
  88. * @return string[]
  89. */
  90. public function getAssociationNames();
  91. /**
  92. * Returns a type name of this field.
  93. *
  94. * This type names can be implementation specific but should at least include the php types:
  95. * integer, string, boolean, float/double, datetime.
  96. *
  97. * @param string $fieldName
  98. *
  99. * @return string
  100. */
  101. public function getTypeOfField($fieldName);
  102. /**
  103. * Returns the target class name of the given association.
  104. *
  105. * @param string $assocName
  106. *
  107. * @return string
  108. */
  109. public function getAssociationTargetClass($assocName);
  110. /**
  111. * Checks if the association is the inverse side of a bidirectional association.
  112. *
  113. * @param string $assocName
  114. *
  115. * @return bool
  116. */
  117. public function isAssociationInverseSide($assocName);
  118. /**
  119. * Returns the target field of the owning side of the association.
  120. *
  121. * @param string $assocName
  122. *
  123. * @return string
  124. */
  125. public function getAssociationMappedByTargetField($assocName);
  126. /**
  127. * Returns the identifier of this object as an array with field name as key.
  128. *
  129. * Has to return an empty array if no identifier isset.
  130. *
  131. * @param object $object
  132. *
  133. * @return mixed[]
  134. */
  135. public function getIdentifierValues($object);
  136. }