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.
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>.
20 namespace Doctrine\Common\Persistence\Mapping;
23 * Contract for a Doctrine persistence layer ClassMetadata class to implement.
25 * @link www.doctrine-project.org
27 * @author Benjamin Eberlei <kontakt@beberlei.de>
28 * @author Jonathan Wage <jonwage@gmail.com>
30 interface ClassMetadata
33 * Gets the fully-qualified class name of this persistent class.
37 public function getName();
40 * Gets the mapped identifier field name.
42 * The returned structure is an array of the identifier field names.
46 public function getIdentifier();
49 * Gets the ReflectionClass instance for this mapped class.
51 * @return \ReflectionClass
53 public function getReflectionClass();
56 * Checks if the given field name is a mapped identifier for this class.
58 * @param string $fieldName
62 public function isIdentifier($fieldName);
65 * Checks if the given field is a mapped property for this class.
67 * @param string $fieldName
71 public function hasField($fieldName);
74 * Checks if the given field is a mapped association for this class.
76 * @param string $fieldName
80 public function hasAssociation($fieldName);
83 * Checks if the given field is a mapped single valued association for this class.
85 * @param string $fieldName
89 public function isSingleValuedAssociation($fieldName);
92 * Checks if the given field is a mapped collection valued association for this class.
94 * @param string $fieldName
98 public function isCollectionValuedAssociation($fieldName);
101 * A numerically indexed list of field names of this persistent class.
103 * This array includes identifier fields if present on this class.
107 public function getFieldNames();
110 * Returns an array of identifier field names numerically indexed.
114 public function getIdentifierFieldNames();
117 * Returns a numerically indexed list of association names of this persistent class.
119 * This array includes identifier associations if present on this class.
123 public function getAssociationNames();
126 * Returns a type name of this field.
128 * This type names can be implementation specific but should at least include the php types:
129 * integer, string, boolean, float/double, datetime.
131 * @param string $fieldName
135 public function getTypeOfField($fieldName);
138 * Returns the target class name of the given association.
140 * @param string $assocName
144 public function getAssociationTargetClass($assocName);
147 * Checks if the association is the inverse side of a bidirectional association.
149 * @param string $assocName
153 public function isAssociationInverseSide($assocName);
156 * Returns the target field of the owning side of the association.
158 * @param string $assocName
162 public function getAssociationMappedByTargetField($assocName);
165 * Returns the identifier of this object as an array with field name as key.
167 * Has to return an empty array if no identifier isset.
169 * @param object $object
173 public function getIdentifierValues($object);