Complex classes like ClassMetadata often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ClassMetadata, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
53 | class ClassMetadata implements BaseClassMetadata |
||
54 | { |
||
55 | /* The Id generator types. */ |
||
56 | /** |
||
57 | * AUTO means Doctrine will automatically create a new \MongoDB\BSON\ObjectId instance for us. |
||
58 | */ |
||
59 | public const GENERATOR_TYPE_AUTO = 1; |
||
60 | |||
61 | /** |
||
62 | * INCREMENT means a separate collection is used for maintaining and incrementing id generation. |
||
63 | * Offers full portability. |
||
64 | */ |
||
65 | public const GENERATOR_TYPE_INCREMENT = 2; |
||
66 | |||
67 | /** |
||
68 | * UUID means Doctrine will generate a uuid for us. |
||
69 | */ |
||
70 | public const GENERATOR_TYPE_UUID = 3; |
||
71 | |||
72 | /** |
||
73 | * ALNUM means Doctrine will generate Alpha-numeric string identifiers, using the INCREMENT |
||
74 | * generator to ensure identifier uniqueness |
||
75 | */ |
||
76 | public const GENERATOR_TYPE_ALNUM = 4; |
||
77 | |||
78 | /** |
||
79 | * CUSTOM means Doctrine expect a class parameter. It will then try to initiate that class |
||
80 | * and pass other options to the generator. It will throw an Exception if the class |
||
81 | * does not exist or if an option was passed for that there is not setter in the new |
||
82 | * generator class. |
||
83 | * |
||
84 | * The class will have to be a subtype of AbstractIdGenerator. |
||
85 | */ |
||
86 | public const GENERATOR_TYPE_CUSTOM = 5; |
||
87 | |||
88 | /** |
||
89 | * NONE means Doctrine will not generate any id for us and you are responsible for manually |
||
90 | * assigning an id. |
||
91 | */ |
||
92 | public const GENERATOR_TYPE_NONE = 6; |
||
93 | |||
94 | /** |
||
95 | * Default discriminator field name. |
||
96 | * |
||
97 | * This is used for associations value for associations where a that do not define a "targetDocument" or |
||
98 | * "discriminatorField" option in their mapping. |
||
99 | */ |
||
100 | public const DEFAULT_DISCRIMINATOR_FIELD = '_doctrine_class_name'; |
||
101 | |||
102 | public const REFERENCE_ONE = 1; |
||
103 | public const REFERENCE_MANY = 2; |
||
104 | public const EMBED_ONE = 3; |
||
105 | public const EMBED_MANY = 4; |
||
106 | public const MANY = 'many'; |
||
107 | public const ONE = 'one'; |
||
108 | |||
109 | /** |
||
110 | * The types of storeAs references |
||
111 | */ |
||
112 | public const REFERENCE_STORE_AS_ID = 'id'; |
||
113 | public const REFERENCE_STORE_AS_DB_REF = 'dbRef'; |
||
114 | public const REFERENCE_STORE_AS_DB_REF_WITH_DB = 'dbRefWithDb'; |
||
115 | public const REFERENCE_STORE_AS_REF = 'ref'; |
||
116 | |||
117 | /* The inheritance mapping types */ |
||
118 | /** |
||
119 | * NONE means the class does not participate in an inheritance hierarchy |
||
120 | * and therefore does not need an inheritance mapping type. |
||
121 | */ |
||
122 | public const INHERITANCE_TYPE_NONE = 1; |
||
123 | |||
124 | /** |
||
125 | * SINGLE_COLLECTION means the class will be persisted according to the rules of |
||
126 | * <tt>Single Collection Inheritance</tt>. |
||
127 | */ |
||
128 | public const INHERITANCE_TYPE_SINGLE_COLLECTION = 2; |
||
129 | |||
130 | /** |
||
131 | * COLLECTION_PER_CLASS means the class will be persisted according to the rules |
||
132 | * of <tt>Concrete Collection Inheritance</tt>. |
||
133 | */ |
||
134 | public const INHERITANCE_TYPE_COLLECTION_PER_CLASS = 3; |
||
135 | |||
136 | /** |
||
137 | * DEFERRED_IMPLICIT means that changes of entities are calculated at commit-time |
||
138 | * by doing a property-by-property comparison with the original data. This will |
||
139 | * be done for all entities that are in MANAGED state at commit-time. |
||
140 | * |
||
141 | * This is the default change tracking policy. |
||
142 | */ |
||
143 | public const CHANGETRACKING_DEFERRED_IMPLICIT = 1; |
||
144 | |||
145 | /** |
||
146 | * DEFERRED_EXPLICIT means that changes of entities are calculated at commit-time |
||
147 | * by doing a property-by-property comparison with the original data. This will |
||
148 | * be done only for entities that were explicitly saved (through persist() or a cascade). |
||
149 | */ |
||
150 | public const CHANGETRACKING_DEFERRED_EXPLICIT = 2; |
||
151 | |||
152 | /** |
||
153 | * NOTIFY means that Doctrine relies on the entities sending out notifications |
||
154 | * when their properties change. Such entity classes must implement |
||
155 | * the <tt>NotifyPropertyChanged</tt> interface. |
||
156 | */ |
||
157 | public const CHANGETRACKING_NOTIFY = 3; |
||
158 | |||
159 | /** |
||
160 | * SET means that fields will be written to the database using a $set operator |
||
161 | */ |
||
162 | public const STORAGE_STRATEGY_SET = 'set'; |
||
163 | |||
164 | /** |
||
165 | * INCREMENT means that fields will be written to the database by calculating |
||
166 | * the difference and using the $inc operator |
||
167 | */ |
||
168 | public const STORAGE_STRATEGY_INCREMENT = 'increment'; |
||
169 | |||
170 | public const STORAGE_STRATEGY_PUSH_ALL = 'pushAll'; |
||
171 | public const STORAGE_STRATEGY_ADD_TO_SET = 'addToSet'; |
||
172 | public const STORAGE_STRATEGY_ATOMIC_SET = 'atomicSet'; |
||
173 | public const STORAGE_STRATEGY_ATOMIC_SET_ARRAY = 'atomicSetArray'; |
||
174 | public const STORAGE_STRATEGY_SET_ARRAY = 'setArray'; |
||
175 | |||
176 | /** |
||
177 | * READ-ONLY: The name of the mongo database the document is mapped to. |
||
178 | * @var string |
||
179 | */ |
||
180 | public $db; |
||
181 | |||
182 | /** |
||
183 | * READ-ONLY: The name of the mongo collection the document is mapped to. |
||
184 | * @var string |
||
185 | */ |
||
186 | public $collection; |
||
187 | |||
188 | /** |
||
189 | * READ-ONLY: If the collection should be a fixed size. |
||
190 | * @var bool |
||
191 | */ |
||
192 | public $collectionCapped; |
||
193 | |||
194 | /** |
||
195 | * READ-ONLY: If the collection is fixed size, its size in bytes. |
||
196 | * @var int|null |
||
197 | */ |
||
198 | public $collectionSize; |
||
199 | |||
200 | /** |
||
201 | * READ-ONLY: If the collection is fixed size, the maximum number of elements to store in the collection. |
||
202 | * @var int|null |
||
203 | */ |
||
204 | public $collectionMax; |
||
205 | |||
206 | /** |
||
207 | * READ-ONLY Describes how MongoDB clients route read operations to the members of a replica set. |
||
208 | * @var string|int|null |
||
209 | */ |
||
210 | public $readPreference; |
||
211 | |||
212 | /** |
||
213 | * READ-ONLY Associated with readPreference Allows to specify criteria so that your application can target read |
||
214 | * operations to specific members, based on custom parameters. |
||
215 | * @var string[][]|null |
||
216 | */ |
||
217 | public $readPreferenceTags; |
||
218 | |||
219 | /** |
||
220 | * READ-ONLY: Describes the level of acknowledgement requested from MongoDB for write operations. |
||
221 | * @var string|int|null |
||
222 | */ |
||
223 | public $writeConcern; |
||
224 | |||
225 | /** |
||
226 | * READ-ONLY: The field name of the document identifier. |
||
227 | * @var string|null |
||
228 | */ |
||
229 | public $identifier; |
||
230 | |||
231 | /** |
||
232 | * READ-ONLY: The array of indexes for the document collection. |
||
233 | * @var array |
||
234 | */ |
||
235 | public $indexes = []; |
||
236 | |||
237 | /** |
||
238 | * READ-ONLY: Keys and options describing shard key. Only for sharded collections. |
||
239 | * @var string|null |
||
240 | */ |
||
241 | public $shardKey; |
||
242 | |||
243 | /** |
||
244 | * READ-ONLY: The name of the document class. |
||
245 | * @var string |
||
246 | */ |
||
247 | public $name; |
||
248 | |||
249 | /** |
||
250 | * READ-ONLY: The namespace the document class is contained in. |
||
251 | * |
||
252 | * @var string |
||
253 | * @todo Not really needed. Usage could be localized. |
||
254 | */ |
||
255 | public $namespace; |
||
256 | |||
257 | /** |
||
258 | * READ-ONLY: The name of the document class that is at the root of the mapped document inheritance |
||
259 | * hierarchy. If the document is not part of a mapped inheritance hierarchy this is the same |
||
260 | * as {@link $documentName}. |
||
261 | * |
||
262 | * @var string |
||
263 | */ |
||
264 | public $rootDocumentName; |
||
265 | |||
266 | /** |
||
267 | * The name of the custom repository class used for the document class. |
||
268 | * (Optional). |
||
269 | * |
||
270 | * @var string |
||
271 | */ |
||
272 | public $customRepositoryClassName; |
||
273 | |||
274 | /** |
||
275 | * READ-ONLY: The names of the parent classes (ancestors). |
||
276 | * |
||
277 | * @var array |
||
278 | */ |
||
279 | public $parentClasses = []; |
||
280 | |||
281 | /** |
||
282 | * READ-ONLY: The names of all subclasses (descendants). |
||
283 | * |
||
284 | * @var array |
||
285 | */ |
||
286 | public $subClasses = []; |
||
287 | |||
288 | /** |
||
289 | * The ReflectionProperty instances of the mapped class. |
||
290 | * |
||
291 | * @var \ReflectionProperty[] |
||
292 | */ |
||
293 | public $reflFields = []; |
||
294 | |||
295 | /** |
||
296 | * READ-ONLY: The inheritance mapping type used by the class. |
||
297 | * |
||
298 | * @var int |
||
299 | */ |
||
300 | public $inheritanceType = self::INHERITANCE_TYPE_NONE; |
||
301 | |||
302 | /** |
||
303 | * READ-ONLY: The Id generator type used by the class. |
||
304 | * |
||
305 | * @var string |
||
306 | */ |
||
307 | public $generatorType = self::GENERATOR_TYPE_AUTO; |
||
308 | |||
309 | /** |
||
310 | * READ-ONLY: The Id generator options. |
||
311 | * |
||
312 | * @var array |
||
313 | */ |
||
314 | public $generatorOptions = []; |
||
315 | |||
316 | /** |
||
317 | * READ-ONLY: The ID generator used for generating IDs for this class. |
||
318 | * |
||
319 | * @var AbstractIdGenerator |
||
320 | */ |
||
321 | public $idGenerator; |
||
322 | |||
323 | /** |
||
324 | * READ-ONLY: The field mappings of the class. |
||
325 | * Keys are field names and values are mapping definitions. |
||
326 | * |
||
327 | * The mapping definition array has the following values: |
||
328 | * |
||
329 | * - <b>fieldName</b> (string) |
||
330 | * The name of the field in the Document. |
||
331 | * |
||
332 | * - <b>id</b> (boolean, optional) |
||
333 | * Marks the field as the primary key of the document. Multiple fields of an |
||
334 | * document can have the id attribute, forming a composite key. |
||
335 | * |
||
336 | * @var array |
||
337 | */ |
||
338 | public $fieldMappings = []; |
||
339 | |||
340 | /** |
||
341 | * READ-ONLY: The association mappings of the class. |
||
342 | * Keys are field names and values are mapping definitions. |
||
343 | * |
||
344 | * @var array |
||
345 | */ |
||
346 | public $associationMappings = []; |
||
347 | |||
348 | /** |
||
349 | * READ-ONLY: Array of fields to also load with a given method. |
||
350 | * |
||
351 | * @var array |
||
352 | */ |
||
353 | public $alsoLoadMethods = []; |
||
354 | |||
355 | /** |
||
356 | * READ-ONLY: The registered lifecycle callbacks for documents of this class. |
||
357 | * |
||
358 | * @var array |
||
359 | */ |
||
360 | public $lifecycleCallbacks = []; |
||
361 | |||
362 | /** |
||
363 | * READ-ONLY: The discriminator value of this class. |
||
364 | * |
||
365 | * <b>This does only apply to the JOINED and SINGLE_COLLECTION inheritance mapping strategies |
||
366 | * where a discriminator field is used.</b> |
||
367 | * |
||
368 | * @var mixed |
||
369 | * @see discriminatorField |
||
370 | */ |
||
371 | public $discriminatorValue; |
||
372 | |||
373 | /** |
||
374 | * READ-ONLY: The discriminator map of all mapped classes in the hierarchy. |
||
375 | * |
||
376 | * <b>This does only apply to the SINGLE_COLLECTION inheritance mapping strategy |
||
377 | * where a discriminator field is used.</b> |
||
378 | * |
||
379 | * @var mixed |
||
380 | * @see discriminatorField |
||
381 | */ |
||
382 | public $discriminatorMap = []; |
||
383 | |||
384 | /** |
||
385 | * READ-ONLY: The definition of the discriminator field used in SINGLE_COLLECTION |
||
386 | * inheritance mapping. |
||
387 | * |
||
388 | * @var string |
||
389 | */ |
||
390 | public $discriminatorField; |
||
391 | |||
392 | /** |
||
393 | * READ-ONLY: The default value for discriminatorField in case it's not set in the document |
||
394 | * |
||
395 | * @var string |
||
396 | * @see discriminatorField |
||
397 | */ |
||
398 | public $defaultDiscriminatorValue; |
||
399 | |||
400 | /** |
||
401 | * READ-ONLY: Whether this class describes the mapping of a mapped superclass. |
||
402 | * |
||
403 | * @var bool |
||
404 | */ |
||
405 | public $isMappedSuperclass = false; |
||
406 | |||
407 | /** |
||
408 | * READ-ONLY: Whether this class describes the mapping of a embedded document. |
||
409 | * |
||
410 | * @var bool |
||
411 | */ |
||
412 | public $isEmbeddedDocument = false; |
||
413 | |||
414 | /** |
||
415 | * READ-ONLY: Whether this class describes the mapping of an aggregation result document. |
||
416 | * |
||
417 | * @var bool |
||
418 | */ |
||
419 | public $isQueryResultDocument = false; |
||
420 | |||
421 | /** |
||
422 | * READ-ONLY: Whether this class describes the mapping of a gridFS file |
||
423 | * |
||
424 | * @var bool |
||
425 | */ |
||
426 | public $isFile = false; |
||
427 | |||
428 | /** |
||
429 | * READ-ONLY: The policy used for change-tracking on entities of this class. |
||
430 | * |
||
431 | * @var int |
||
432 | */ |
||
433 | public $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT; |
||
434 | |||
435 | /** |
||
436 | * READ-ONLY: A flag for whether or not instances of this class are to be versioned |
||
437 | * with optimistic locking. |
||
438 | * |
||
439 | * @var bool $isVersioned |
||
440 | */ |
||
441 | public $isVersioned; |
||
442 | |||
443 | /** |
||
444 | * READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any). |
||
445 | * |
||
446 | * @var mixed $versionField |
||
447 | */ |
||
448 | public $versionField; |
||
449 | |||
450 | /** |
||
451 | * READ-ONLY: A flag for whether or not instances of this class are to allow pessimistic |
||
452 | * locking. |
||
453 | * |
||
454 | * @var bool $isLockable |
||
455 | */ |
||
456 | public $isLockable; |
||
457 | |||
458 | /** |
||
459 | * READ-ONLY: The name of the field which is used for locking a document. |
||
460 | * |
||
461 | * @var mixed $lockField |
||
462 | */ |
||
463 | public $lockField; |
||
464 | |||
465 | /** |
||
466 | * The ReflectionClass instance of the mapped class. |
||
467 | * |
||
468 | * @var \ReflectionClass |
||
469 | */ |
||
470 | public $reflClass; |
||
471 | |||
472 | /** |
||
473 | * READ_ONLY: A flag for whether or not this document is read-only. |
||
474 | * |
||
475 | * @var bool |
||
476 | */ |
||
477 | public $isReadOnly; |
||
478 | |||
479 | /** @var InstantiatorInterface|null */ |
||
480 | private $instantiator; |
||
481 | 1478 | ||
482 | /** |
||
483 | 1478 | * Initializes a new ClassMetadata instance that will hold the object-document mapping |
|
484 | 1478 | * metadata of the class with the given name. |
|
485 | 1478 | * |
|
486 | 1478 | * @param string $documentName The name of the document class the new instance is used for. |
|
487 | 1478 | */ |
|
488 | 1478 | public function __construct($documentName) |
|
497 | |||
498 | 121 | /** |
|
499 | * Helper method to get reference id of ref* type references |
||
500 | 121 | * @param mixed $reference |
|
501 | * @param string $storeAs |
||
502 | * @return mixed |
||
503 | * @internal |
||
504 | */ |
||
505 | public static function getReferenceId($reference, $storeAs) |
||
509 | |||
510 | 186 | /** |
|
511 | * Returns the reference prefix used for a reference |
||
512 | * @param string $storeAs |
||
513 | * @return string |
||
514 | 186 | */ |
|
515 | private static function getReferencePrefix($storeAs) |
||
523 | |||
524 | 134 | /** |
|
525 | * Returns a fully qualified field name for a given reference |
||
526 | 134 | * @param string $storeAs |
|
527 | 94 | * @param string $pathPrefix The field path prefix |
|
528 | * @return string |
||
529 | * @internal |
||
530 | 122 | */ |
|
531 | public static function getReferenceFieldName($storeAs, $pathPrefix = '') |
||
539 | |||
540 | /** |
||
541 | * {@inheritDoc} |
||
542 | 1366 | */ |
|
543 | public function getReflectionClass() |
||
551 | |||
552 | /** |
||
553 | * {@inheritDoc} |
||
554 | */ |
||
555 | public function isIdentifier($fieldName) |
||
559 | 887 | ||
560 | /** |
||
561 | 887 | * INTERNAL: |
|
562 | 887 | * Sets the mapped identifier field of this class. |
|
563 | * |
||
564 | * @param string $identifier |
||
565 | */ |
||
566 | public function setIdentifier($identifier) |
||
570 | 39 | ||
571 | /** |
||
572 | 39 | * {@inheritDoc} |
|
573 | * |
||
574 | * Since MongoDB only allows exactly one identifier field |
||
575 | * this will always return an array with only one value |
||
576 | */ |
||
577 | public function getIdentifier() |
||
581 | 98 | ||
582 | /** |
||
583 | 98 | * {@inheritDoc} |
|
584 | * |
||
585 | * Since MongoDB only allows exactly one identifier field |
||
586 | * this will always return an array with only one value |
||
587 | */ |
||
588 | public function getIdentifierFieldNames() |
||
592 | |||
593 | /** |
||
594 | * {@inheritDoc} |
||
595 | */ |
||
596 | public function hasField($fieldName) |
||
600 | |||
601 | 903 | /** |
|
602 | 903 | * Sets the inheritance type used by the class and it's subclasses. |
|
603 | * |
||
604 | * @param int $type |
||
605 | */ |
||
606 | public function setInheritanceType($type) |
||
610 | |||
611 | 1362 | /** |
|
612 | * Checks whether a mapped field is inherited from an entity superclass. |
||
613 | 1362 | * |
|
614 | * @param string $fieldName |
||
615 | * |
||
616 | * @return bool TRUE if the field is inherited, FALSE otherwise. |
||
617 | */ |
||
618 | public function isInheritedField($fieldName) |
||
622 | |||
623 | 835 | /** |
|
624 | * Registers a custom repository class for the document class. |
||
625 | * |
||
626 | * @param string $repositoryClassName The class name of the custom repository. |
||
627 | 835 | */ |
|
628 | 3 | public function setCustomRepositoryClass($repositoryClassName) |
|
640 | |||
641 | /** |
||
642 | * Dispatches the lifecycle event of the given document by invoking all |
||
643 | * registered callbacks. |
||
644 | 599 | * |
|
645 | * @param string $event Lifecycle event |
||
646 | 599 | * @param object $document Document on which the event occurred |
|
647 | 1 | * @param array $arguments Arguments to pass to all callbacks |
|
648 | * @throws \InvalidArgumentException If document class is not this class or |
||
649 | * a Proxy of this class. |
||
650 | 598 | */ |
|
651 | 583 | public function invokeLifecycleCallbacks($event, $document, ?array $arguments = null) |
|
669 | |||
670 | /** |
||
671 | * Checks whether the class has callbacks registered for a lifecycle event. |
||
672 | * |
||
673 | * @param string $event Lifecycle event |
||
674 | * |
||
675 | * @return bool |
||
676 | */ |
||
677 | public function hasLifecycleCallbacks($event) |
||
681 | |||
682 | /** |
||
683 | * Gets the registered lifecycle callbacks for an event. |
||
684 | * |
||
685 | * @param string $event |
||
686 | * @return array |
||
687 | */ |
||
688 | public function getLifecycleCallbacks($event) |
||
692 | |||
693 | /** |
||
694 | 802 | * Adds a lifecycle callback for documents of this class. |
|
695 | * |
||
696 | 802 | * If the callback is already registered, this is a NOOP. |
|
697 | 1 | * |
|
698 | * @param string $callback |
||
699 | * @param string $event |
||
700 | 802 | */ |
|
701 | 802 | public function addLifecycleCallback($callback, $event) |
|
709 | |||
710 | 886 | /** |
|
711 | * Sets the lifecycle callbacks for documents of this class. |
||
712 | 886 | * |
|
713 | 886 | * Any previously registered callbacks are overwritten. |
|
714 | * |
||
715 | * @param array $callbacks |
||
716 | */ |
||
717 | public function setLifecycleCallbacks(array $callbacks) |
||
721 | |||
722 | /** |
||
723 | * Registers a method for loading document data before field hydration. |
||
724 | 14 | * |
|
725 | * Note: A method may be registered multiple times for different fields. |
||
726 | 14 | * it will be invoked only once for the first field found. |
|
727 | 14 | * |
|
728 | * @param string $method Method name |
||
729 | * @param array|string $fields Database field name(s) |
||
730 | */ |
||
731 | public function registerAlsoLoadMethod($method, $fields) |
||
735 | |||
736 | 886 | /** |
|
737 | * Sets the AlsoLoad methods for documents of this class. |
||
738 | 886 | * |
|
739 | 886 | * Any previously registered methods are overwritten. |
|
740 | * |
||
741 | * @param array $methods |
||
742 | */ |
||
743 | public function setAlsoLoadMethods(array $methods) |
||
747 | |||
748 | /** |
||
749 | * Sets the discriminator field. |
||
750 | * |
||
751 | * The field name is the the unmapped database field. Discriminator values |
||
752 | * are only used to discern the hydration class and are not mapped to class |
||
753 | 912 | * properties. |
|
754 | * |
||
755 | 912 | * @param string $discriminatorField |
|
756 | 844 | * |
|
757 | * @throws MappingException If the discriminator field conflicts with the |
||
758 | 844 | * "name" attribute of a mapped field. |
|
759 | */ |
||
760 | public function setDiscriminatorField($discriminatorField) |
||
789 | 905 | ||
790 | 112 | /** |
|
791 | 82 | * Sets the discriminator values used by this class. |
|
792 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies. |
||
793 | 112 | * |
|
794 | 112 | * @param array $map |
|
795 | 104 | * |
|
796 | * @throws MappingException |
||
797 | 111 | */ |
|
798 | public function setDiscriminatorMap(array $map) |
||
821 | |||
822 | /** |
||
823 | 48 | * Sets the default discriminator value to be used for this class |
|
824 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies if the document has no discriminator value |
||
825 | * |
||
826 | * @param string $defaultDiscriminatorValue |
||
827 | 48 | * |
|
828 | 48 | * @throws MappingException |
|
829 | */ |
||
830 | public function setDefaultDiscriminatorValue($defaultDiscriminatorValue) |
||
848 | |||
849 | 183 | /** |
|
850 | * Sets the discriminator value for this class. |
||
851 | 183 | * Used for JOINED/SINGLE_TABLE inheritance and multiple document types in a single |
|
852 | * collection. |
||
853 | 183 | * |
|
854 | 45 | * @param string $value |
|
855 | * |
||
856 | 183 | * @throws MappingException |
|
857 | 183 | */ |
|
858 | 183 | public function setDiscriminatorValue($value) |
|
867 | 183 | ||
868 | 183 | /** |
|
869 | * Add a index for this Document. |
||
870 | 183 | * |
|
871 | * @param array $keys Array of keys for the index. |
||
872 | * @param array $options Array of options for the index. |
||
873 | */ |
||
874 | public function addIndex($keys, array $options = []) |
||
896 | |||
897 | /** |
||
898 | * Returns the array of indexes for this Document. |
||
899 | * |
||
900 | 71 | * @return array $indexes The array of indexes. |
|
901 | */ |
||
902 | 71 | public function getIndexes() |
|
906 | 71 | ||
907 | 2 | /** |
|
908 | * Checks whether this document has indexes or not. |
||
909 | * |
||
910 | 69 | * @return bool |
|
911 | 69 | */ |
|
912 | 62 | public function hasIndexes() |
|
916 | 3 | ||
917 | /** |
||
918 | * Set shard key for this Document. |
||
919 | 4 | * |
|
920 | 4 | * @param array $keys Array of document keys. |
|
921 | * @param array $options Array of sharding options. |
||
922 | * |
||
923 | * @throws MappingException |
||
924 | 65 | */ |
|
925 | public function setShardKey(array $keys, array $options = []) |
||
969 | 886 | ||
970 | /** |
||
971 | 886 | * @return array |
|
972 | 886 | */ |
|
973 | 886 | public function getShardKey() |
|
977 | |||
978 | /** |
||
979 | * Checks whether this document has shard key or not. |
||
980 | 896 | * |
|
981 | * @return bool |
||
982 | 896 | */ |
|
983 | 896 | public function isSharded() |
|
987 | |||
988 | 11 | /** |
|
989 | * Sets the read preference used by this class. |
||
990 | 11 | * |
|
991 | * @param string $readPreference |
||
992 | * @param array|null $tags |
||
993 | */ |
||
994 | public function setReadPreference($readPreference, $tags) |
||
999 | |||
1000 | 548 | /** |
|
1001 | * Sets the write concern used by this class. |
||
1002 | * |
||
1003 | * @param string $writeConcern |
||
1004 | */ |
||
1005 | public function setWriteConcern($writeConcern) |
||
1009 | |||
1010 | 888 | /** |
|
1011 | 888 | * @return string |
|
1012 | */ |
||
1013 | public function getWriteConcern() |
||
1017 | |||
1018 | 62 | /** |
|
1019 | * Whether there is a write concern configured for this class. |
||
1020 | 62 | * |
|
1021 | * @return bool |
||
1022 | */ |
||
1023 | public function hasWriteConcern() |
||
1027 | |||
1028 | 568 | /** |
|
1029 | * Sets the change tracking policy used by this class. |
||
1030 | 568 | * |
|
1031 | * @param int $policy |
||
1032 | */ |
||
1033 | public function setChangeTrackingPolicy($policy) |
||
1037 | |||
1038 | 309 | /** |
|
1039 | * Whether the change tracking policy of this class is "deferred explicit". |
||
1040 | 309 | * |
|
1041 | * @return bool |
||
1042 | */ |
||
1043 | public function isChangeTrackingDeferredExplicit() |
||
1047 | |||
1048 | 98 | /** |
|
1049 | * Whether the change tracking policy of this class is "deferred implicit". |
||
1050 | 98 | * |
|
1051 | * @return bool |
||
1052 | */ |
||
1053 | public function isChangeTrackingDeferredImplicit() |
||
1057 | |||
1058 | /** |
||
1059 | * Whether the change tracking policy of this class is "notify". |
||
1060 | * |
||
1061 | * @return bool |
||
1062 | */ |
||
1063 | public function isChangeTrackingNotify() |
||
1067 | |||
1068 | 1371 | /** |
|
1069 | * Gets the ReflectionProperties of the mapped class. |
||
1070 | 1371 | * |
|
1071 | * @return array An array of ReflectionProperty instances. |
||
1072 | */ |
||
1073 | public function getReflectionProperties() |
||
1077 | |||
1078 | /** |
||
1079 | * Gets a ReflectionProperty for a specific field of the mapped class. |
||
1080 | * |
||
1081 | * @param string $name |
||
1082 | * |
||
1083 | * @return \ReflectionProperty |
||
1084 | */ |
||
1085 | public function getReflectionProperty($name) |
||
1089 | |||
1090 | 1295 | /** |
|
1091 | * {@inheritDoc} |
||
1092 | */ |
||
1093 | public function getName() |
||
1097 | |||
1098 | 92 | /** |
|
1099 | * The namespace this Document class belongs to. |
||
1100 | 92 | * |
|
1101 | 92 | * @return string $namespace The namespace name. |
|
1102 | */ |
||
1103 | public function getNamespace() |
||
1107 | |||
1108 | 1296 | /** |
|
1109 | * Returns the database this Document is mapped to. |
||
1110 | 1296 | * |
|
1111 | * @return string $db The database name. |
||
1112 | */ |
||
1113 | public function getDatabase() |
||
1117 | |||
1118 | /** |
||
1119 | * Set the database this Document is mapped to. |
||
1120 | 1478 | * |
|
1121 | * @param string $db The database name |
||
1122 | 1478 | */ |
|
1123 | 1 | public function setDatabase($db) |
|
1127 | 1 | ||
1128 | 1 | /** |
|
1129 | 1 | * Get the collection this Document is mapped to. |
|
1130 | * |
||
1131 | 1478 | * @return string $collection The collection name. |
|
1132 | */ |
||
1133 | 1478 | public function getCollection() |
|
1137 | |||
1138 | /** |
||
1139 | * Sets the collection this Document is mapped to. |
||
1140 | 5 | * |
|
1141 | * @param array|string $name |
||
1142 | 5 | * |
|
1143 | * @throws \InvalidArgumentException |
||
1144 | */ |
||
1145 | public function setCollection($name) |
||
1159 | |||
1160 | 5 | /** |
|
1161 | * Get whether or not the documents collection is capped. |
||
1162 | 5 | * |
|
1163 | * @return bool |
||
1164 | */ |
||
1165 | public function getCollectionCapped() |
||
1169 | |||
1170 | 1 | /** |
|
1171 | * Set whether or not the documents collection is capped. |
||
1172 | 1 | * |
|
1173 | 1 | * @param bool $bool |
|
1174 | */ |
||
1175 | public function setCollectionCapped($bool) |
||
1179 | |||
1180 | 5 | /** |
|
1181 | * Get the collection size |
||
1182 | 5 | * |
|
1183 | * @return int |
||
1184 | */ |
||
1185 | public function getCollectionSize() |
||
1189 | |||
1190 | 1 | /** |
|
1191 | * Set the collection size. |
||
1192 | 1 | * |
|
1193 | 1 | * @param int $size |
|
1194 | */ |
||
1195 | public function setCollectionSize($size) |
||
1199 | |||
1200 | /** |
||
1201 | * Get the collection max. |
||
1202 | * |
||
1203 | * @return int |
||
1204 | */ |
||
1205 | public function getCollectionMax() |
||
1209 | |||
1210 | 1388 | /** |
|
1211 | * Set the collection max. |
||
1212 | 1388 | * |
|
1213 | 1370 | * @param int $max |
|
1214 | */ |
||
1215 | public function setCollectionMax($max) |
||
1219 | 819 | ||
1220 | 819 | /** |
|
1221 | 819 | * Returns TRUE if this Document is mapped to a collection FALSE otherwise. |
|
1222 | * |
||
1223 | 1352 | * @return bool |
|
1224 | 1076 | */ |
|
1225 | public function isMappedToCollection() |
||
1229 | 1076 | ||
1230 | 1076 | /** |
|
1231 | 1076 | * Validates the storage strategy of a mapping for consistency |
|
1232 | * @param array $mapping |
||
1233 | 1076 | * @throws MappingException |
|
1234 | */ |
||
1235 | private function applyStorageStrategy(array &$mapping) |
||
1278 | |||
1279 | /** |
||
1280 | * Map a single embedded document. |
||
1281 | * |
||
1282 | * @param array $mapping The mapping information. |
||
1283 | 2 | */ |
|
1284 | public function mapOneEmbedded(array $mapping) |
||
1290 | |||
1291 | /** |
||
1292 | * Map a collection of embedded documents. |
||
1293 | * |
||
1294 | * @param array $mapping The mapping information. |
||
1295 | 1 | */ |
|
1296 | public function mapManyEmbedded(array $mapping) |
||
1302 | |||
1303 | /** |
||
1304 | * Map a single document reference. |
||
1305 | * |
||
1306 | * @param array $mapping The mapping information. |
||
1307 | */ |
||
1308 | public function mapOneReference(array $mapping) |
||
1314 | 116 | ||
1315 | /** |
||
1316 | * Map a collection of document references. |
||
1317 | 67 | * |
|
1318 | 67 | * @param array $mapping The mapping information. |
|
1319 | */ |
||
1320 | public function mapManyReference(array $mapping) |
||
1326 | |||
1327 | /** |
||
1328 | * INTERNAL: |
||
1329 | * Adds a field mapping without completing/validating it. |
||
1330 | 68 | * This is mainly used to add inherited field mappings to derived classes. |
|
1331 | * |
||
1332 | 68 | * @param array $fieldMapping |
|
1333 | 68 | */ |
|
1334 | public function addInheritedFieldMapping(array $fieldMapping) |
||
1344 | |||
1345 | /** |
||
1346 | * INTERNAL: |
||
1347 | * Adds an association mapping without completing/validating it. |
||
1348 | * This is mainly used to add inherited association mappings to derived classes. |
||
1349 | * |
||
1350 | * @param array $mapping |
||
1351 | * |
||
1352 | 5 | * |
|
1353 | * @throws MappingException |
||
1354 | 5 | */ |
|
1355 | public function addInheritedAssociationMapping(array $mapping/*, $owningClassName = null*/) |
||
1359 | |||
1360 | /** |
||
1361 | * Checks whether the class has a mapped association with the given field name. |
||
1362 | 7 | * |
|
1363 | * @param string $fieldName |
||
1364 | 7 | * @return bool |
|
1365 | */ |
||
1366 | public function hasReference($fieldName) |
||
1370 | |||
1371 | /** |
||
1372 | * Checks whether the class has a mapped embed with the given field name. |
||
1373 | * |
||
1374 | * @param string $fieldName |
||
1375 | * @return bool |
||
1376 | */ |
||
1377 | public function hasEmbed($fieldName) |
||
1381 | |||
1382 | /** |
||
1383 | * {@inheritDoc} |
||
1384 | * |
||
1385 | * Checks whether the class has a mapped association (embed or reference) with the given field name. |
||
1386 | */ |
||
1387 | public function hasAssociation($fieldName) |
||
1391 | |||
1392 | /** |
||
1393 | * {@inheritDoc} |
||
1394 | * |
||
1395 | * Checks whether the class has a mapped reference or embed for the specified field and |
||
1396 | * is a single valued association. |
||
1397 | */ |
||
1398 | public function isSingleValuedAssociation($fieldName) |
||
1402 | |||
1403 | /** |
||
1404 | * {@inheritDoc} |
||
1405 | * |
||
1406 | * Checks whether the class has a mapped reference or embed for the specified field and |
||
1407 | * is a collection valued association. |
||
1408 | */ |
||
1409 | public function isCollectionValuedAssociation($fieldName) |
||
1413 | |||
1414 | /** |
||
1415 | * Checks whether the class has a mapped association for the specified field |
||
1416 | * and if yes, checks whether it is a single-valued association (to-one). |
||
1417 | * |
||
1418 | * @param string $fieldName |
||
1419 | * @return bool TRUE if the association exists and is single-valued, FALSE otherwise. |
||
1420 | */ |
||
1421 | public function isSingleValuedReference($fieldName) |
||
1426 | |||
1427 | /** |
||
1428 | * Checks whether the class has a mapped association for the specified field |
||
1429 | * and if yes, checks whether it is a collection-valued association (to-many). |
||
1430 | * |
||
1431 | * @param string $fieldName |
||
1432 | * @return bool TRUE if the association exists and is collection-valued, FALSE otherwise. |
||
1433 | */ |
||
1434 | public function isCollectionValuedReference($fieldName) |
||
1439 | |||
1440 | /** |
||
1441 | * Checks whether the class has a mapped embedded document for the specified field |
||
1442 | * and if yes, checks whether it is a single-valued association (to-one). |
||
1443 | * |
||
1444 | * @param string $fieldName |
||
1445 | * @return bool TRUE if the association exists and is single-valued, FALSE otherwise. |
||
1446 | 1307 | */ |
|
1447 | public function isSingleValuedEmbed($fieldName) |
||
1452 | |||
1453 | /** |
||
1454 | * Checks whether the class has a mapped embedded document for the specified field |
||
1455 | * and if yes, checks whether it is a collection-valued association (to-many). |
||
1456 | * |
||
1457 | 591 | * @param string $fieldName |
|
1458 | * @return bool TRUE if the association exists and is collection-valued, FALSE otherwise. |
||
1459 | 591 | */ |
|
1460 | 591 | public function isCollectionValuedEmbed($fieldName) |
|
1465 | |||
1466 | /** |
||
1467 | * Sets the ID generator used to generate IDs for instances of this class. |
||
1468 | * |
||
1469 | 655 | * @param AbstractIdGenerator $generator |
|
1470 | */ |
||
1471 | 655 | public function setIdGenerator($generator) |
|
1475 | |||
1476 | /** |
||
1477 | * Casts the identifier to its portable PHP type. |
||
1478 | * |
||
1479 | * @param mixed $id |
||
1480 | * @return mixed $id |
||
1481 | */ |
||
1482 | public function getPHPIdentifierValue($id) |
||
1487 | 520 | ||
1488 | /** |
||
1489 | * Casts the identifier to its database type. |
||
1490 | * |
||
1491 | * @param mixed $id |
||
1492 | * @return mixed $id |
||
1493 | */ |
||
1494 | public function getDatabaseIdentifierValue($id) |
||
1499 | |||
1500 | /** |
||
1501 | * Sets the document identifier of a document. |
||
1502 | * |
||
1503 | * The value will be converted to a PHP type before being set. |
||
1504 | * |
||
1505 | * @param object $document |
||
1506 | * @param mixed $id |
||
1507 | */ |
||
1508 | public function setIdentifierValue($document, $id) |
||
1513 | |||
1514 | /** |
||
1515 | * Gets the document identifier as a PHP type. |
||
1516 | * |
||
1517 | * @param object $document |
||
1518 | * @return mixed $id |
||
1519 | 31 | */ |
|
1520 | public function getIdentifierValue($document) |
||
1524 | |||
1525 | /** |
||
1526 | * {@inheritDoc} |
||
1527 | * |
||
1528 | * Since MongoDB only allows exactly one identifier field this is a proxy |
||
1529 | * to {@see getIdentifierValue()} and returns an array with the identifier |
||
1530 | * field as a key. |
||
1531 | 8 | */ |
|
1532 | public function getIdentifierValues($object) |
||
1536 | 1 | ||
1537 | /** |
||
1538 | * Get the document identifier object as a database type. |
||
1539 | 8 | * |
|
1540 | 8 | * @param object $document |
|
1541 | * |
||
1542 | * @return ObjectId $id The ObjectId |
||
1543 | */ |
||
1544 | public function getIdentifierObject($document) |
||
1548 | |||
1549 | /** |
||
1550 | 27 | * Sets the specified field to the specified value on the given document. |
|
1551 | * |
||
1552 | 27 | * @param object $document |
|
1553 | 1 | * @param string $field |
|
1554 | * @param mixed $value |
||
1555 | */ |
||
1556 | 27 | public function setFieldValue($document, $field, $value) |
|
1566 | |||
1567 | /** |
||
1568 | 167 | * Gets the specified field's value off the given document. |
|
1569 | * |
||
1570 | 167 | * @param object $document |
|
1571 | 6 | * @param string $field |
|
1572 | * |
||
1573 | 165 | * @return mixed |
|
1574 | */ |
||
1575 | public function getFieldValue($document, $field) |
||
1583 | 559 | ||
1584 | 559 | /** |
|
1585 | * Gets the mapping of a field. |
||
1586 | 424 | * |
|
1587 | 559 | * @param string $fieldName The field name. |
|
1588 | * |
||
1589 | * @return array The field mapping. |
||
1590 | * |
||
1591 | * @throws MappingException If the $fieldName is not found in the fieldMappings array. |
||
1592 | */ |
||
1593 | public function getFieldMapping($fieldName) |
||
1600 | 4 | ||
1601 | /** |
||
1602 | 4 | * Gets mappings of fields holding embedded document(s). |
|
1603 | 4 | * |
|
1604 | 4 | * @return array of field mappings |
|
1605 | */ |
||
1606 | public function getEmbeddedFieldsMappings() |
||
1615 | |||
1616 | /** |
||
1617 | * Gets the field mapping by its DB name. |
||
1618 | 1 | * E.g. it returns identifier's mapping when called with _id. |
|
1619 | * |
||
1620 | 1 | * @param string $dbFieldName |
|
1621 | 1 | * |
|
1622 | 1 | * @return array |
|
1623 | * @throws MappingException |
||
1624 | */ |
||
1625 | public function getFieldMappingByDbFieldName($dbFieldName) |
||
1635 | |||
1636 | /** |
||
1637 | * Check if the field is not null. |
||
1638 | * |
||
1639 | * @param string $fieldName The field name |
||
1640 | * |
||
1641 | * @return bool TRUE if the field is not null, FALSE otherwise. |
||
1642 | 886 | */ |
|
1643 | public function isNullable($fieldName) |
||
1651 | |||
1652 | /** |
||
1653 | * Checks whether the document has a discriminator field and value configured. |
||
1654 | * |
||
1655 | * @return bool |
||
1656 | */ |
||
1657 | public function hasDiscriminator() |
||
1661 | |||
1662 | 566 | /** |
|
1663 | * Sets the type of Id generator to use for the mapped class. |
||
1664 | * |
||
1665 | * @param string $generatorType Generator type. |
||
1666 | */ |
||
1667 | public function setIdGeneratorType($generatorType) |
||
1671 | |||
1672 | 885 | /** |
|
1673 | * Sets the Id generator options. |
||
1674 | * |
||
1675 | * @param array $generatorOptions Generator options. |
||
1676 | */ |
||
1677 | public function setIdGeneratorOptions($generatorOptions) |
||
1681 | |||
1682 | /** |
||
1683 | * @return bool |
||
1684 | */ |
||
1685 | public function isInheritanceTypeNone() |
||
1689 | |||
1690 | 2 | /** |
|
1691 | * Checks whether the mapped class uses the SINGLE_COLLECTION inheritance mapping strategy. |
||
1692 | 2 | * |
|
1693 | 2 | * @return bool |
|
1694 | 1 | */ |
|
1695 | public function isInheritanceTypeSingleCollection() |
||
1699 | 2 | ||
1700 | /** |
||
1701 | * Checks whether the mapped class uses the COLLECTION_PER_CLASS inheritance mapping strategy. |
||
1702 | * |
||
1703 | * @return bool |
||
1704 | */ |
||
1705 | public function isInheritanceTypeCollectionPerClass() |
||
1709 | |||
1710 | 1362 | /** |
|
1711 | * Sets the mapped subclasses of this class. |
||
1712 | 1362 | * |
|
1713 | 1361 | * @param string[] $subclasses The names of all mapped subclasses. |
|
1714 | */ |
||
1715 | public function setSubclasses(array $subclasses) |
||
1725 | |||
1726 | /** |
||
1727 | * Sets the parent class names. |
||
1728 | * Assumes that the class names in the passed array are in the order: |
||
1729 | * directParent -> directParentParent -> directParentParentParent ... -> root. |
||
1730 | * |
||
1731 | * @param string[] $classNames |
||
1732 | */ |
||
1733 | public function setParentClasses(array $classNames) |
||
1743 | |||
1744 | /** |
||
1745 | * Checks whether the class will generate a new \MongoDB\BSON\ObjectId instance for us. |
||
1746 | * |
||
1747 | * @return bool TRUE if the class uses the AUTO generator, FALSE otherwise. |
||
1748 | */ |
||
1749 | public function isIdGeneratorAuto() |
||
1753 | |||
1754 | /** |
||
1755 | * Checks whether the class will use a collection to generate incremented identifiers. |
||
1756 | * |
||
1757 | * @return bool TRUE if the class uses the INCREMENT generator, FALSE otherwise. |
||
1758 | */ |
||
1759 | public function isIdGeneratorIncrement() |
||
1763 | |||
1764 | /** |
||
1765 | * Checks whether the class will generate a uuid id. |
||
1766 | * |
||
1767 | 67 | * @return bool TRUE if the class uses the UUID generator, FALSE otherwise. |
|
1768 | */ |
||
1769 | 67 | public function isIdGeneratorUuid() |
|
1773 | 66 | ||
1774 | 66 | /** |
|
1775 | 66 | * Checks whether the class uses no id generator. |
|
1776 | * |
||
1777 | * @return bool TRUE if the class does not use any id generator, FALSE otherwise. |
||
1778 | */ |
||
1779 | public function isIdGeneratorNone() |
||
1783 | |||
1784 | 886 | /** |
|
1785 | 886 | * Sets the version field mapping used for versioning. Sets the default |
|
1786 | * value to use depending on the column type. |
||
1787 | * |
||
1788 | * @param array $mapping The version field mapping array |
||
1789 | * |
||
1790 | * @throws LockException |
||
1791 | */ |
||
1792 | public function setVersionMapping(array &$mapping) |
||
1801 | |||
1802 | /** |
||
1803 | * Sets whether this class is to be versioned for optimistic locking. |
||
1804 | * |
||
1805 | * @param bool $bool |
||
1806 | 22 | */ |
|
1807 | public function setVersioned($bool) |
||
1811 | |||
1812 | 21 | /** |
|
1813 | 21 | * Sets the name of the field that is to be used for versioning if this class is |
|
1814 | 21 | * versioned for optimistic locking. |
|
1815 | * |
||
1816 | * @param string $versionField |
||
1817 | */ |
||
1818 | public function setVersionField($versionField) |
||
1822 | |||
1823 | /** |
||
1824 | * Sets the version field mapping used for versioning. Sets the default |
||
1825 | * value to use depending on the column type. |
||
1826 | * |
||
1827 | * @param array $mapping The version field mapping array |
||
1828 | * |
||
1829 | * @throws LockException |
||
1830 | */ |
||
1831 | public function setLockMapping(array &$mapping) |
||
1840 | 5 | ||
1841 | /** |
||
1842 | 5 | * Sets whether this class is to allow pessimistic locking. |
|
1843 | 5 | * |
|
1844 | * @param bool $bool |
||
1845 | */ |
||
1846 | public function setLockable($bool) |
||
1850 | |||
1851 | /** |
||
1852 | * Sets the name of the field that is to be used for storing whether a document |
||
1853 | * is currently locked or not. |
||
1854 | * |
||
1855 | * @param string $lockField |
||
1856 | */ |
||
1857 | public function setLockField($lockField) |
||
1861 | |||
1862 | /** |
||
1863 | * Marks this class as read only, no change tracking is applied to it. |
||
1864 | 23 | */ |
|
1865 | public function markReadOnly() |
||
1869 | |||
1870 | /** |
||
1871 | * {@inheritDoc} |
||
1872 | */ |
||
1873 | 4 | public function getFieldNames() |
|
1877 | |||
1878 | /** |
||
1879 | 2 | * {@inheritDoc} |
|
1880 | */ |
||
1881 | public function getAssociationNames() |
||
1885 | |||
1886 | /** |
||
1887 | 1 | * {@inheritDoc} |
|
1888 | */ |
||
1889 | 1 | public function getTypeOfField($fieldName) |
|
1894 | |||
1895 | /** |
||
1896 | * {@inheritDoc} |
||
1897 | 1 | */ |
|
1898 | public function getAssociationTargetClass($assocName) |
||
1906 | |||
1907 | /** |
||
1908 | * Retrieve the collectionClass associated with an association |
||
1909 | * |
||
1910 | * @param string $assocName |
||
1911 | */ |
||
1912 | public function getAssociationCollectionClass($assocName) |
||
1924 | |||
1925 | 1403 | /** |
|
1926 | * {@inheritDoc} |
||
1927 | 1403 | */ |
|
1928 | 8 | public function isAssociationInverseSide($fieldName) |
|
1932 | |||
1933 | 1403 | /** |
|
1934 | 1394 | * {@inheritDoc} |
|
1935 | */ |
||
1936 | 1403 | public function getAssociationMappedByTargetField($fieldName) |
|
1940 | 1 | ||
1941 | /** |
||
1942 | 1401 | * Map a field. |
|
1943 | 1103 | * |
|
1944 | * @param array $mapping The mapping information. |
||
1945 | 1401 | * |
|
1946 | 53 | * @return array |
|
1947 | 51 | * |
|
1948 | * @throws MappingException |
||
1949 | 53 | */ |
|
1950 | public function mapField(array $mapping) |
||
2127 | |||
2128 | /** |
||
2129 | * Determines which fields get serialized. |
||
2130 | * |
||
2131 | * It is only serialized what is necessary for best unserialization performance. |
||
2132 | * That means any metadata properties that are not set or empty or simply have |
||
2133 | * their default value are NOT serialized. |
||
2134 | * |
||
2135 | * Parts that are also NOT serialized because they can not be properly unserialized: |
||
2136 | * - reflClass (ReflectionClass) |
||
2137 | * - reflFields (ReflectionProperty array) |
||
2138 | * |
||
2139 | * @return array The names of all the fields that should be serialized. |
||
2140 | 6 | */ |
|
2141 | public function __sleep() |
||
2219 | |||
2220 | 355 | /** |
|
2221 | * Restores some state that can not be serialized/unserialized. |
||
2222 | * |
||
2223 | */ |
||
2224 | public function __wakeup() |
||
2240 | |||
2241 | /** |
||
2242 | * Creates a new instance of the mapped class, without invoking the constructor. |
||
2243 | * |
||
2244 | * @return object |
||
2245 | */ |
||
2246 | public function newInstance() |
||
2250 | |||
2251 | private function isAllowedGridFSField(string $name): bool |
||
2255 | } |
||
2256 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..