~ubuntu-branches/ubuntu/wily/php-doctrine-common/wily-proposed

« back to all changes in this revision

Viewing changes to lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php

  • Committer: Package Import Robot
  • Author(s): David Prévot
  • Date: 2014-06-15 11:26:00 UTC
  • mfrom: (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140615112600-sg4mgpwq9sfg4mre
Tags: 2.4.2-2
* Upload to unstable
* No tests if DEB_BUILD_OPTIONS contains nocheck

Show diffs side-by-side

added added

removed removed

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