Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / common / lib / Doctrine / Common / Persistence / Mapping / ClassMetadata.php
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
20 namespace Doctrine\Common\Persistence\Mapping;
21
22 /**
23  * Contract for a Doctrine persistence layer ClassMetadata class to implement.
24  *
25  * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
26  * @link    www.doctrine-project.org
27  * @since   2.1
28  * @author  Benjamin Eberlei <kontakt@beberlei.de>
29  * @author  Jonathan Wage <jonwage@gmail.com>
30  */
31 interface ClassMetadata
32 {
33     /**
34      * Get fully-qualified class name of this persistent class.
35      *
36      * @return string
37      */
38     function getName();
39
40     /**
41      * Gets the mapped identifier field name.
42      *
43      * The returned structure is an array of the identifier field names.
44      *
45      * @return array
46      */
47     function getIdentifier();
48
49     /**
50      * Gets the ReflectionClass instance for this mapped class.
51      *
52      * @return \ReflectionClass
53      */
54     function getReflectionClass();
55
56     /**
57      * Checks if the given field name is a mapped identifier for this class.
58      *
59      * @param string $fieldName
60      * @return boolean
61      */
62     function isIdentifier($fieldName);
63
64     /**
65      * Checks if the given field is a mapped property for this class.
66      *
67      * @param string $fieldName
68      * @return boolean
69      */
70     function hasField($fieldName);
71
72     /**
73      * Checks if the given field is a mapped association for this class.
74      *
75      * @param string $fieldName
76      * @return boolean
77      */
78     function hasAssociation($fieldName);
79
80     /**
81      * Checks if the given field is a mapped single valued association for this class.
82      *
83      * @param string $fieldName
84      * @return boolean
85      */
86     function isSingleValuedAssociation($fieldName);
87
88     /**
89      * Checks if the given field is a mapped collection valued association for this class.
90      *
91      * @param string $fieldName
92      * @return boolean
93      */
94     function isCollectionValuedAssociation($fieldName);
95
96     /**
97      * A numerically indexed list of field names of this persistent class.
98      *
99      * This array includes identifier fields if present on this class.
100      *
101      * @return array
102      */
103     function getFieldNames();
104
105     /**
106      * Returns an array of identifier field names numerically indexed.
107      *
108      * @return array
109      */
110     function getIdentifierFieldNames();
111
112     /**
113      * A numerically indexed list of association names of this persistent class.
114      *
115      * This array includes identifier associations if present on this class.
116      *
117      * @return array
118      */
119     function getAssociationNames();
120
121     /**
122      * Returns a type name of this field.
123      *
124      * This type names can be implementation specific but should at least include the php types:
125      * integer, string, boolean, float/double, datetime.
126      *
127      * @param string $fieldName
128      * @return string
129      */
130     function getTypeOfField($fieldName);
131
132     /**
133      * Returns the target class name of the given association.
134      *
135      * @param string $assocName
136      * @return string
137      */
138     function getAssociationTargetClass($assocName);
139
140     /**
141      * Checks if the association is the inverse side of a bidirectional association
142      *
143      * @param string $assocName
144      * @return boolean
145      */
146     function isAssociationInverseSide($assocName);
147
148     /**
149      * Returns the target field of the owning side of the association
150      *
151      * @param string $assocName
152      * @return string
153      */
154     function getAssociationMappedByTargetField($assocName);
155
156     /**
157      * Return the identifier of this object as an array with field name as key.
158      *
159      * Has to return an empty array if no identifier isset.
160      *
161      * @param object $object
162      * @return array
163      */
164     function getIdentifierValues($object);
165 }