|
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 LGPL. 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 public 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 public function getIdentifier(); |
|
48 |
|
49 /** |
|
50 * Gets the ReflectionClass instance for this mapped class. |
|
51 * |
|
52 * @return ReflectionClass |
|
53 */ |
|
54 public 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 public 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 public 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 public 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 public 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 public 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 public function getFieldNames(); |
|
104 |
|
105 /** |
|
106 * A numerically indexed list of association names of this persistent class. |
|
107 * |
|
108 * This array includes identifier associations if present on this class. |
|
109 * |
|
110 * @return array |
|
111 */ |
|
112 public function getAssociationNames(); |
|
113 |
|
114 /** |
|
115 * Returns a type name of this field. |
|
116 * |
|
117 * This type names can be implementation specific but should at least include the php types: |
|
118 * integer, string, boolean, float/double, datetime. |
|
119 * |
|
120 * @param string $fieldName |
|
121 * @return string |
|
122 */ |
|
123 public function getTypeOfField($fieldName); |
|
124 |
|
125 /** |
|
126 * Returns the target class name of the given association. |
|
127 * |
|
128 * @param string $assocName |
|
129 * @return string |
|
130 */ |
|
131 public function getAssociationTargetClass($assocName); |
|
132 } |