1 | <?php |
||
30 | class MappingException extends BaseMappingException |
||
31 | { |
||
32 | /** |
||
33 | * @param string $name |
||
34 | * @return MappingException |
||
35 | */ |
||
36 | public static function typeExists($name) |
||
40 | |||
41 | /** |
||
42 | * @param string $name |
||
43 | * @return MappingException |
||
44 | */ |
||
45 | public static function typeNotFound($name) |
||
49 | |||
50 | /** |
||
51 | * @param string $className |
||
52 | * @param string $fieldName |
||
53 | * @return MappingException |
||
54 | */ |
||
55 | public static function mappingNotFound($className, $fieldName) |
||
59 | |||
60 | /** |
||
61 | * @param string $document |
||
62 | * @param string $fieldName |
||
63 | * @return MappingException |
||
64 | */ |
||
65 | public static function duplicateFieldMapping($document, $fieldName) |
||
69 | |||
70 | /** |
||
71 | * @param string $document |
||
72 | * @param string $fieldName |
||
73 | * @return MappingException |
||
74 | */ |
||
75 | 2 | public static function discriminatorFieldConflict($document, $fieldName) |
|
76 | { |
||
77 | 2 | return new self('Discriminator field "' . $fieldName . '" in "' . $document . '" conflicts with a mapped field\'s "name" attribute.'); |
|
78 | } |
||
79 | |||
80 | /** |
||
81 | * Throws an exception that indicates that a class used in a discriminator map does not exist. |
||
82 | * An example would be an outdated (maybe renamed) classname. |
||
83 | * |
||
84 | * @param string $className The class that could not be found |
||
85 | * @param string $owningClass The class that declares the discriminator map. |
||
86 | * @return MappingException |
||
87 | */ |
||
88 | public static function invalidClassInDiscriminatorMap($className, $owningClass) |
||
95 | |||
96 | /** |
||
97 | * Throws an exception that indicates a discriminator value does not exist in a map |
||
98 | * |
||
99 | * @param string $value The discriminator value that could not be found |
||
100 | * @param string $owningClass The class that declares the discriminator map |
||
101 | * @return MappingException |
||
102 | */ |
||
103 | public static function invalidDiscriminatorValue($value, $owningClass) |
||
107 | |||
108 | /** |
||
109 | * @param string $className |
||
110 | * @return MappingException |
||
111 | */ |
||
112 | public static function missingFieldName($className) |
||
116 | |||
117 | /** |
||
118 | * @param string $className |
||
119 | * @return MappingException |
||
120 | */ |
||
121 | 2 | public static function classIsNotAValidDocument($className) |
|
125 | |||
126 | /** |
||
127 | * Exception for reflection exceptions - adds the document name, |
||
128 | * because there might be long classnames that will be shortened |
||
129 | * within the stacktrace |
||
130 | * |
||
131 | * @param string $document The document's name |
||
132 | * @param \ReflectionException $previousException |
||
133 | * @return \Doctrine\ODM\MongoDB\Mapping\MappingException |
||
134 | */ |
||
135 | public static function reflectionFailure($document, \ReflectionException $previousException) |
||
139 | |||
140 | /** |
||
141 | * @param string $documentName |
||
142 | * @return MappingException |
||
143 | */ |
||
144 | public static function identifierRequired($documentName) |
||
149 | |||
150 | /** |
||
151 | * @param string $className |
||
152 | * @param string $fieldName |
||
153 | * @return MappingException |
||
154 | */ |
||
155 | public static function missingIdentifierField($className, $fieldName) |
||
159 | |||
160 | /** |
||
161 | * @param string $className |
||
162 | * @return MappingException |
||
163 | */ |
||
164 | public static function missingIdGeneratorClass($className) |
||
168 | |||
169 | /** |
||
170 | * @param string $className |
||
171 | * @return MappingException |
||
172 | */ |
||
173 | public static function classIsNotAValidGenerator($className) |
||
177 | |||
178 | /** |
||
179 | * @param string $className |
||
180 | * @param string $optionName |
||
181 | * @return MappingException |
||
182 | */ |
||
183 | public static function missingGeneratorSetter($className, $optionName) |
||
187 | |||
188 | /** |
||
189 | * @param string $className |
||
190 | * @param string $fieldName |
||
191 | * @return MappingException |
||
192 | */ |
||
193 | 1 | public static function cascadeOnEmbeddedNotAllowed($className, $fieldName) |
|
197 | |||
198 | /** |
||
199 | * @param string $className |
||
200 | * @param string $fieldName |
||
201 | * @return MappingException |
||
202 | */ |
||
203 | 1 | public static function simpleReferenceRequiresTargetDocument($className, $fieldName) |
|
207 | |||
208 | /** |
||
209 | * @param string $targetDocument |
||
210 | * @return MappingException |
||
211 | */ |
||
212 | 1 | public static function simpleReferenceMustNotTargetDiscriminatedDocument($targetDocument) |
|
216 | |||
217 | /** |
||
218 | * @param string $strategy |
||
219 | * @param string $className |
||
220 | * @param string $fieldName |
||
221 | * @return MappingException |
||
222 | */ |
||
223 | 1 | public static function atomicCollectionStrategyNotAllowed($strategy, $className, $fieldName) |
|
227 | |||
228 | /** |
||
229 | * @param string $className |
||
230 | * @param string $fieldName |
||
231 | * @return MappingException |
||
232 | */ |
||
233 | 4 | public static function owningAndInverseReferencesRequireTargetDocument($className, $fieldName) |
|
237 | |||
238 | /** |
||
239 | * @param string $className |
||
240 | * @param string $fieldName |
||
241 | * @return MappingException |
||
242 | */ |
||
243 | 1 | public static function mustNotChangeIdentifierFieldsType($className, $fieldName) |
|
244 | { |
||
245 | 1 | return new self("$className::$fieldName was declared an identifier and must stay this way."); |
|
246 | } |
||
247 | |||
248 | /** |
||
249 | * @param string $className |
||
250 | * @param string $fieldName |
||
251 | * @param string $strategy |
||
252 | * @return MappingException |
||
253 | */ |
||
254 | 1 | public static function referenceManySortMustNotBeUsedWithNonSetCollectionStrategy($className, $fieldName, $strategy) |
|
258 | |||
259 | /** |
||
260 | * |
||
261 | * @param string $className |
||
262 | * @param string $fieldName |
||
263 | * @param string $collectionClass |
||
264 | * @return MappingException |
||
265 | */ |
||
266 | 1 | public static function collectionClassDoesNotImplementCommonInterface($className, $fieldName, $collectionClass) |
|
270 | } |
||
271 |