Chris@0
|
1 <?php
|
Chris@0
|
2 /*
|
Chris@0
|
3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
Chris@0
|
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
Chris@0
|
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
Chris@0
|
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
Chris@0
|
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
Chris@0
|
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
Chris@0
|
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
Chris@0
|
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
Chris@0
|
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
Chris@0
|
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
Chris@0
|
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Chris@0
|
14 *
|
Chris@0
|
15 * This software consists of voluntary contributions made by many individuals
|
Chris@0
|
16 * and is licensed under the MIT license. For more information, see
|
Chris@0
|
17 * <http://www.doctrine-project.org>.
|
Chris@0
|
18 */
|
Chris@0
|
19
|
Chris@0
|
20 namespace Doctrine\Common\Persistence\Mapping;
|
Chris@0
|
21
|
Chris@0
|
22 /**
|
Chris@0
|
23 * Contract for a Doctrine persistence layer ClassMetadata class to implement.
|
Chris@0
|
24 *
|
Chris@0
|
25 * @link www.doctrine-project.org
|
Chris@0
|
26 * @since 2.1
|
Chris@0
|
27 * @author Benjamin Eberlei <kontakt@beberlei.de>
|
Chris@0
|
28 * @author Jonathan Wage <jonwage@gmail.com>
|
Chris@0
|
29 */
|
Chris@0
|
30 interface ClassMetadata
|
Chris@0
|
31 {
|
Chris@0
|
32 /**
|
Chris@0
|
33 * Gets the fully-qualified class name of this persistent class.
|
Chris@0
|
34 *
|
Chris@0
|
35 * @return string
|
Chris@0
|
36 */
|
Chris@0
|
37 public function getName();
|
Chris@0
|
38
|
Chris@0
|
39 /**
|
Chris@0
|
40 * Gets the mapped identifier field name.
|
Chris@0
|
41 *
|
Chris@0
|
42 * The returned structure is an array of the identifier field names.
|
Chris@0
|
43 *
|
Chris@0
|
44 * @return array
|
Chris@0
|
45 */
|
Chris@0
|
46 public function getIdentifier();
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Gets the ReflectionClass instance for this mapped class.
|
Chris@0
|
50 *
|
Chris@0
|
51 * @return \ReflectionClass
|
Chris@0
|
52 */
|
Chris@0
|
53 public function getReflectionClass();
|
Chris@0
|
54
|
Chris@0
|
55 /**
|
Chris@0
|
56 * Checks if the given field name is a mapped identifier for this class.
|
Chris@0
|
57 *
|
Chris@0
|
58 * @param string $fieldName
|
Chris@0
|
59 *
|
Chris@0
|
60 * @return boolean
|
Chris@0
|
61 */
|
Chris@0
|
62 public function isIdentifier($fieldName);
|
Chris@0
|
63
|
Chris@0
|
64 /**
|
Chris@0
|
65 * Checks if the given field is a mapped property for this class.
|
Chris@0
|
66 *
|
Chris@0
|
67 * @param string $fieldName
|
Chris@0
|
68 *
|
Chris@0
|
69 * @return boolean
|
Chris@0
|
70 */
|
Chris@0
|
71 public function hasField($fieldName);
|
Chris@0
|
72
|
Chris@0
|
73 /**
|
Chris@0
|
74 * Checks if the given field is a mapped association for this class.
|
Chris@0
|
75 *
|
Chris@0
|
76 * @param string $fieldName
|
Chris@0
|
77 *
|
Chris@0
|
78 * @return boolean
|
Chris@0
|
79 */
|
Chris@0
|
80 public function hasAssociation($fieldName);
|
Chris@0
|
81
|
Chris@0
|
82 /**
|
Chris@0
|
83 * Checks if the given field is a mapped single valued association for this class.
|
Chris@0
|
84 *
|
Chris@0
|
85 * @param string $fieldName
|
Chris@0
|
86 *
|
Chris@0
|
87 * @return boolean
|
Chris@0
|
88 */
|
Chris@0
|
89 public function isSingleValuedAssociation($fieldName);
|
Chris@0
|
90
|
Chris@0
|
91 /**
|
Chris@0
|
92 * Checks if the given field is a mapped collection valued association for this class.
|
Chris@0
|
93 *
|
Chris@0
|
94 * @param string $fieldName
|
Chris@0
|
95 *
|
Chris@0
|
96 * @return boolean
|
Chris@0
|
97 */
|
Chris@0
|
98 public function isCollectionValuedAssociation($fieldName);
|
Chris@0
|
99
|
Chris@0
|
100 /**
|
Chris@0
|
101 * A numerically indexed list of field names of this persistent class.
|
Chris@0
|
102 *
|
Chris@0
|
103 * This array includes identifier fields if present on this class.
|
Chris@0
|
104 *
|
Chris@0
|
105 * @return array
|
Chris@0
|
106 */
|
Chris@0
|
107 public function getFieldNames();
|
Chris@0
|
108
|
Chris@0
|
109 /**
|
Chris@0
|
110 * Returns an array of identifier field names numerically indexed.
|
Chris@0
|
111 *
|
Chris@0
|
112 * @return array
|
Chris@0
|
113 */
|
Chris@0
|
114 public function getIdentifierFieldNames();
|
Chris@0
|
115
|
Chris@0
|
116 /**
|
Chris@0
|
117 * Returns a numerically indexed list of association names of this persistent class.
|
Chris@0
|
118 *
|
Chris@0
|
119 * This array includes identifier associations if present on this class.
|
Chris@0
|
120 *
|
Chris@0
|
121 * @return array
|
Chris@0
|
122 */
|
Chris@0
|
123 public function getAssociationNames();
|
Chris@0
|
124
|
Chris@0
|
125 /**
|
Chris@0
|
126 * Returns a type name of this field.
|
Chris@0
|
127 *
|
Chris@0
|
128 * This type names can be implementation specific but should at least include the php types:
|
Chris@0
|
129 * integer, string, boolean, float/double, datetime.
|
Chris@0
|
130 *
|
Chris@0
|
131 * @param string $fieldName
|
Chris@0
|
132 *
|
Chris@0
|
133 * @return string
|
Chris@0
|
134 */
|
Chris@0
|
135 public function getTypeOfField($fieldName);
|
Chris@0
|
136
|
Chris@0
|
137 /**
|
Chris@0
|
138 * Returns the target class name of the given association.
|
Chris@0
|
139 *
|
Chris@0
|
140 * @param string $assocName
|
Chris@0
|
141 *
|
Chris@0
|
142 * @return string
|
Chris@0
|
143 */
|
Chris@0
|
144 public function getAssociationTargetClass($assocName);
|
Chris@0
|
145
|
Chris@0
|
146 /**
|
Chris@0
|
147 * Checks if the association is the inverse side of a bidirectional association.
|
Chris@0
|
148 *
|
Chris@0
|
149 * @param string $assocName
|
Chris@0
|
150 *
|
Chris@0
|
151 * @return boolean
|
Chris@0
|
152 */
|
Chris@0
|
153 public function isAssociationInverseSide($assocName);
|
Chris@0
|
154
|
Chris@0
|
155 /**
|
Chris@0
|
156 * Returns the target field of the owning side of the association.
|
Chris@0
|
157 *
|
Chris@0
|
158 * @param string $assocName
|
Chris@0
|
159 *
|
Chris@0
|
160 * @return string
|
Chris@0
|
161 */
|
Chris@0
|
162 public function getAssociationMappedByTargetField($assocName);
|
Chris@0
|
163
|
Chris@0
|
164 /**
|
Chris@0
|
165 * Returns the identifier of this object as an array with field name as key.
|
Chris@0
|
166 *
|
Chris@0
|
167 * Has to return an empty array if no identifier isset.
|
Chris@0
|
168 *
|
Chris@0
|
169 * @param object $object
|
Chris@0
|
170 *
|
Chris@0
|
171 * @return array
|
Chris@0
|
172 */
|
Chris@0
|
173 public function getIdentifierValues($object);
|
Chris@0
|
174 }
|