1 | <?php |
||
29 | class MappingException extends BaseMappingException |
||
30 | { |
||
31 | /** |
||
32 | * @param string $name |
||
33 | * @return MappingException |
||
34 | */ |
||
35 | public static function typeExists($name) |
||
39 | |||
40 | /** |
||
41 | * @param string $name |
||
42 | * @return MappingException |
||
43 | */ |
||
44 | public static function typeNotFound($name) |
||
48 | |||
49 | /** |
||
50 | * @param string $className |
||
51 | * @param string $fieldName |
||
52 | * @return MappingException |
||
53 | */ |
||
54 | 6 | public static function mappingNotFound($className, $fieldName) |
|
58 | |||
59 | /** |
||
60 | * @param string $className |
||
61 | * @param string $fieldName |
||
62 | * @return MappingException |
||
63 | */ |
||
64 | 2 | public static function mappingNotFoundInClassNorDescendants($className, $fieldName) |
|
68 | |||
69 | /** |
||
70 | * @param $fieldName |
||
71 | * @param $className |
||
72 | * @param $className2 |
||
73 | * @return MappingException |
||
74 | */ |
||
75 | 2 | public static function referenceFieldConflict($fieldName, $className, $className2) |
|
79 | |||
80 | /** |
||
81 | * @param string $document |
||
82 | * @param string $fieldName |
||
83 | * @return MappingException |
||
84 | */ |
||
85 | public static function duplicateFieldMapping($document, $fieldName) |
||
89 | |||
90 | /** |
||
91 | * @param string $document |
||
92 | * @param string $fieldName |
||
93 | * @return MappingException |
||
94 | */ |
||
95 | 2 | public static function discriminatorFieldConflict($document, $fieldName) |
|
99 | |||
100 | /** |
||
101 | * Throws an exception that indicates that a class used in a discriminator map does not exist. |
||
102 | * An example would be an outdated (maybe renamed) classname. |
||
103 | * |
||
104 | * @param string $className The class that could not be found |
||
105 | * @param string $owningClass The class that declares the discriminator map. |
||
106 | * @return MappingException |
||
107 | */ |
||
108 | public static function invalidClassInDiscriminatorMap($className, $owningClass) |
||
109 | { |
||
110 | return new self( |
||
111 | "Document class '$className' used in the discriminator map of class '$owningClass' " . |
||
112 | "does not exist." |
||
113 | ); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Throws an exception that indicates a discriminator value does not exist in a map |
||
118 | * |
||
119 | * @param string $value The discriminator value that could not be found |
||
120 | * @param string $owningClass The class that declares the discriminator map |
||
121 | * @return MappingException |
||
122 | */ |
||
123 | public static function invalidDiscriminatorValue($value, $owningClass) |
||
127 | |||
128 | /** |
||
129 | * @param string $className |
||
130 | * @return MappingException |
||
131 | */ |
||
132 | public static function missingFieldName($className) |
||
136 | |||
137 | /** |
||
138 | * @param string $className |
||
139 | * @return MappingException |
||
140 | */ |
||
141 | 2 | public static function classIsNotAValidDocument($className) |
|
145 | |||
146 | /** |
||
147 | * Exception for reflection exceptions - adds the document name, |
||
148 | * because there might be long classnames that will be shortened |
||
149 | * within the stacktrace |
||
150 | * |
||
151 | * @param string $document The document's name |
||
152 | * @param \ReflectionException $previousException |
||
153 | * @return \Doctrine\ODM\MongoDB\Mapping\MappingException |
||
154 | */ |
||
155 | public static function reflectionFailure($document, \ReflectionException $previousException) |
||
159 | |||
160 | /** |
||
161 | * @param string $documentName |
||
162 | * @return MappingException |
||
163 | */ |
||
164 | public static function identifierRequired($documentName) |
||
165 | { |
||
166 | return new self("No identifier/primary key specified for Document '$documentName'." |
||
167 | . " Every Document must have an identifier/primary key."); |
||
168 | } |
||
169 | |||
170 | /** |
||
171 | * @param string $className |
||
172 | * @param string $fieldName |
||
173 | * @return MappingException |
||
174 | */ |
||
175 | public static function missingIdentifierField($className, $fieldName) |
||
179 | |||
180 | /** |
||
181 | * @param string $className |
||
182 | * @return MappingException |
||
183 | */ |
||
184 | public static function missingIdGeneratorClass($className) |
||
188 | |||
189 | /** |
||
190 | * @param string $className |
||
191 | * @return MappingException |
||
192 | */ |
||
193 | public static function classIsNotAValidGenerator($className) |
||
197 | |||
198 | /** |
||
199 | * @param string $className |
||
200 | * @param string $optionName |
||
201 | * @return MappingException |
||
202 | */ |
||
203 | public static function missingGeneratorSetter($className, $optionName) |
||
207 | |||
208 | /** |
||
209 | * @param string $className |
||
210 | * @param string $fieldName |
||
211 | * @return MappingException |
||
212 | */ |
||
213 | 1 | public static function cascadeOnEmbeddedNotAllowed($className, $fieldName) |
|
217 | |||
218 | /** |
||
219 | * @param string $className |
||
220 | * @param string $fieldName |
||
221 | * @return MappingException |
||
222 | */ |
||
223 | 1 | public static function simpleReferenceRequiresTargetDocument($className, $fieldName) |
|
227 | |||
228 | /** |
||
229 | * @param string $targetDocument |
||
230 | * @return MappingException |
||
231 | */ |
||
232 | 1 | public static function simpleReferenceMustNotTargetDiscriminatedDocument($targetDocument) |
|
236 | |||
237 | /** |
||
238 | * @param string $strategy |
||
239 | * @param string $className |
||
240 | * @param string $fieldName |
||
241 | * @return MappingException |
||
242 | */ |
||
243 | 1 | public static function atomicCollectionStrategyNotAllowed($strategy, $className, $fieldName) |
|
247 | |||
248 | /** |
||
249 | * @param string $className |
||
250 | * @param string $fieldName |
||
251 | * @return MappingException |
||
252 | */ |
||
253 | 4 | public static function owningAndInverseReferencesRequireTargetDocument($className, $fieldName) |
|
257 | |||
258 | /** |
||
259 | * @param string $className |
||
260 | * @param string $fieldName |
||
261 | * @return MappingException |
||
262 | */ |
||
263 | 1 | public static function mustNotChangeIdentifierFieldsType($className, $fieldName) |
|
267 | |||
268 | /** |
||
269 | * @param string $className |
||
270 | * @param string $fieldName |
||
271 | * @param string $strategy |
||
272 | * @return MappingException |
||
273 | */ |
||
274 | 1 | public static function referenceManySortMustNotBeUsedWithNonSetCollectionStrategy($className, $fieldName, $strategy) |
|
278 | |||
279 | /** |
||
280 | * @param string $className |
||
281 | * @param string $fieldName |
||
282 | * @param string $type |
||
283 | * @param string $strategy |
||
284 | * @return MappingException |
||
285 | */ |
||
286 | public static function invalidStorageStrategy($className, $fieldName, $type, $strategy) |
||
290 | } |
||
291 |