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 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
26 * @link www.doctrine-project.org
28 * @author Benjamin Eberlei <kontakt@beberlei.de>
29 * @author Jonathan Wage <jonwage@gmail.com>
31 interface ClassMetadata
34 * Get fully-qualified class name of this persistent class.
41 * Gets the mapped identifier field name.
43 * The returned structure is an array of the identifier field names.
47 function getIdentifier();
50 * Gets the ReflectionClass instance for this mapped class.
52 * @return \ReflectionClass
54 function getReflectionClass();
57 * Checks if the given field name is a mapped identifier for this class.
59 * @param string $fieldName
62 function isIdentifier($fieldName);
65 * Checks if the given field is a mapped property for this class.
67 * @param string $fieldName
70 function hasField($fieldName);
73 * Checks if the given field is a mapped association for this class.
75 * @param string $fieldName
78 function hasAssociation($fieldName);
81 * Checks if the given field is a mapped single valued association for this class.
83 * @param string $fieldName
86 function isSingleValuedAssociation($fieldName);
89 * Checks if the given field is a mapped collection valued association for this class.
91 * @param string $fieldName
94 function isCollectionValuedAssociation($fieldName);
97 * A numerically indexed list of field names of this persistent class.
99 * This array includes identifier fields if present on this class.
103 function getFieldNames();
106 * Returns an array of identifier field names numerically indexed.
110 function getIdentifierFieldNames();
113 * A numerically indexed list of association names of this persistent class.
115 * This array includes identifier associations if present on this class.
119 function getAssociationNames();
122 * Returns a type name of this field.
124 * This type names can be implementation specific but should at least include the php types:
125 * integer, string, boolean, float/double, datetime.
127 * @param string $fieldName
130 function getTypeOfField($fieldName);
133 * Returns the target class name of the given association.
135 * @param string $assocName
138 function getAssociationTargetClass($assocName);
141 * Checks if the association is the inverse side of a bidirectional association
143 * @param string $assocName
146 function isAssociationInverseSide($assocName);
149 * Returns the target field of the owning side of the association
151 * @param string $assocName
154 function getAssociationMappedByTargetField($assocName);
157 * Return the identifier of this object as an array with field name as key.
159 * Has to return an empty array if no identifier isset.
161 * @param object $object
164 function getIdentifierValues($object);