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 | private const ALLOWED_GRIDFS_FIELDS = ['_id', 'chunkSize', 'filename', 'length', 'metadata', 'uploadDate']; |
||
177 | |||
178 | /** |
||
179 | * READ-ONLY: The name of the mongo database the document is mapped to. |
||
180 | * @var string |
||
181 | */ |
||
182 | public $db; |
||
183 | |||
184 | /** |
||
185 | * READ-ONLY: The name of the mongo collection the document is mapped to. |
||
186 | * @var string |
||
187 | */ |
||
188 | public $collection; |
||
189 | |||
190 | /** |
||
191 | * READ-ONLY: The name of the GridFS bucket the document is mapped to. |
||
192 | * @var string |
||
193 | */ |
||
194 | public $bucketName; |
||
195 | |||
196 | /** |
||
197 | * READ-ONLY: If the collection should be a fixed size. |
||
198 | * @var bool |
||
199 | */ |
||
200 | public $collectionCapped; |
||
201 | |||
202 | /** |
||
203 | * READ-ONLY: If the collection is fixed size, its size in bytes. |
||
204 | * @var int|null |
||
205 | */ |
||
206 | public $collectionSize; |
||
207 | |||
208 | /** |
||
209 | * READ-ONLY: If the collection is fixed size, the maximum number of elements to store in the collection. |
||
210 | * @var int|null |
||
211 | */ |
||
212 | public $collectionMax; |
||
213 | |||
214 | /** |
||
215 | * READ-ONLY Describes how MongoDB clients route read operations to the members of a replica set. |
||
216 | * @var string|int|null |
||
217 | */ |
||
218 | public $readPreference; |
||
219 | |||
220 | /** |
||
221 | * READ-ONLY Associated with readPreference Allows to specify criteria so that your application can target read |
||
222 | * operations to specific members, based on custom parameters. |
||
223 | * @var string[][]|null |
||
224 | */ |
||
225 | public $readPreferenceTags; |
||
226 | |||
227 | /** |
||
228 | * READ-ONLY: Describes the level of acknowledgement requested from MongoDB for write operations. |
||
229 | * @var string|int|null |
||
230 | */ |
||
231 | public $writeConcern; |
||
232 | |||
233 | /** |
||
234 | * READ-ONLY: The field name of the document identifier. |
||
235 | * @var string|null |
||
236 | */ |
||
237 | public $identifier; |
||
238 | |||
239 | /** |
||
240 | * READ-ONLY: The array of indexes for the document collection. |
||
241 | * @var array |
||
242 | */ |
||
243 | public $indexes = []; |
||
244 | |||
245 | /** |
||
246 | * READ-ONLY: Keys and options describing shard key. Only for sharded collections. |
||
247 | * @var string|null |
||
248 | */ |
||
249 | public $shardKey; |
||
250 | |||
251 | /** |
||
252 | * READ-ONLY: The name of the document class. |
||
253 | * @var string |
||
254 | */ |
||
255 | public $name; |
||
256 | |||
257 | /** |
||
258 | * READ-ONLY: The namespace the document class is contained in. |
||
259 | * |
||
260 | * @var string |
||
261 | * @todo Not really needed. Usage could be localized. |
||
262 | */ |
||
263 | public $namespace; |
||
264 | |||
265 | /** |
||
266 | * READ-ONLY: The name of the document class that is at the root of the mapped document inheritance |
||
267 | * hierarchy. If the document is not part of a mapped inheritance hierarchy this is the same |
||
268 | * as {@link $documentName}. |
||
269 | * |
||
270 | * @var string |
||
271 | */ |
||
272 | public $rootDocumentName; |
||
273 | |||
274 | /** |
||
275 | * The name of the custom repository class used for the document class. |
||
276 | * (Optional). |
||
277 | * |
||
278 | * @var string |
||
279 | */ |
||
280 | public $customRepositoryClassName; |
||
281 | |||
282 | /** |
||
283 | * READ-ONLY: The names of the parent classes (ancestors). |
||
284 | * |
||
285 | * @var array |
||
286 | */ |
||
287 | public $parentClasses = []; |
||
288 | |||
289 | /** |
||
290 | * READ-ONLY: The names of all subclasses (descendants). |
||
291 | * |
||
292 | * @var array |
||
293 | */ |
||
294 | public $subClasses = []; |
||
295 | |||
296 | /** |
||
297 | * The ReflectionProperty instances of the mapped class. |
||
298 | * |
||
299 | * @var \ReflectionProperty[] |
||
300 | */ |
||
301 | public $reflFields = []; |
||
302 | |||
303 | /** |
||
304 | * READ-ONLY: The inheritance mapping type used by the class. |
||
305 | * |
||
306 | * @var int |
||
307 | */ |
||
308 | public $inheritanceType = self::INHERITANCE_TYPE_NONE; |
||
309 | |||
310 | /** |
||
311 | * READ-ONLY: The Id generator type used by the class. |
||
312 | * |
||
313 | * @var string |
||
314 | */ |
||
315 | public $generatorType = self::GENERATOR_TYPE_AUTO; |
||
316 | |||
317 | /** |
||
318 | * READ-ONLY: The Id generator options. |
||
319 | * |
||
320 | * @var array |
||
321 | */ |
||
322 | public $generatorOptions = []; |
||
323 | |||
324 | /** |
||
325 | * READ-ONLY: The ID generator used for generating IDs for this class. |
||
326 | * |
||
327 | * @var AbstractIdGenerator |
||
328 | */ |
||
329 | public $idGenerator; |
||
330 | |||
331 | /** |
||
332 | * READ-ONLY: The field mappings of the class. |
||
333 | * Keys are field names and values are mapping definitions. |
||
334 | * |
||
335 | * The mapping definition array has the following values: |
||
336 | * |
||
337 | * - <b>fieldName</b> (string) |
||
338 | * The name of the field in the Document. |
||
339 | * |
||
340 | * - <b>id</b> (boolean, optional) |
||
341 | * Marks the field as the primary key of the document. Multiple fields of an |
||
342 | * document can have the id attribute, forming a composite key. |
||
343 | * |
||
344 | * @var array |
||
345 | */ |
||
346 | public $fieldMappings = []; |
||
347 | |||
348 | /** |
||
349 | * READ-ONLY: The association mappings of the class. |
||
350 | * Keys are field names and values are mapping definitions. |
||
351 | * |
||
352 | * @var array |
||
353 | */ |
||
354 | public $associationMappings = []; |
||
355 | |||
356 | /** |
||
357 | * READ-ONLY: Array of fields to also load with a given method. |
||
358 | * |
||
359 | * @var array |
||
360 | */ |
||
361 | public $alsoLoadMethods = []; |
||
362 | |||
363 | /** |
||
364 | * READ-ONLY: The registered lifecycle callbacks for documents of this class. |
||
365 | * |
||
366 | * @var array |
||
367 | */ |
||
368 | public $lifecycleCallbacks = []; |
||
369 | |||
370 | /** |
||
371 | * READ-ONLY: The discriminator value of this class. |
||
372 | * |
||
373 | * <b>This does only apply to the JOINED and SINGLE_COLLECTION inheritance mapping strategies |
||
374 | * where a discriminator field is used.</b> |
||
375 | * |
||
376 | * @var mixed |
||
377 | * @see discriminatorField |
||
378 | */ |
||
379 | public $discriminatorValue; |
||
380 | |||
381 | /** |
||
382 | * READ-ONLY: The discriminator map of all mapped classes in the hierarchy. |
||
383 | * |
||
384 | * <b>This does only apply to the SINGLE_COLLECTION inheritance mapping strategy |
||
385 | * where a discriminator field is used.</b> |
||
386 | * |
||
387 | * @var mixed |
||
388 | * @see discriminatorField |
||
389 | */ |
||
390 | public $discriminatorMap = []; |
||
391 | |||
392 | /** |
||
393 | * READ-ONLY: The definition of the discriminator field used in SINGLE_COLLECTION |
||
394 | * inheritance mapping. |
||
395 | * |
||
396 | * @var string |
||
397 | */ |
||
398 | public $discriminatorField; |
||
399 | |||
400 | /** |
||
401 | * READ-ONLY: The default value for discriminatorField in case it's not set in the document |
||
402 | * |
||
403 | * @var string |
||
404 | * @see discriminatorField |
||
405 | */ |
||
406 | public $defaultDiscriminatorValue; |
||
407 | |||
408 | /** |
||
409 | * READ-ONLY: Whether this class describes the mapping of a mapped superclass. |
||
410 | * |
||
411 | * @var bool |
||
412 | */ |
||
413 | public $isMappedSuperclass = false; |
||
414 | |||
415 | /** |
||
416 | * READ-ONLY: Whether this class describes the mapping of a embedded document. |
||
417 | * |
||
418 | * @var bool |
||
419 | */ |
||
420 | public $isEmbeddedDocument = false; |
||
421 | |||
422 | /** |
||
423 | * READ-ONLY: Whether this class describes the mapping of an aggregation result document. |
||
424 | * |
||
425 | * @var bool |
||
426 | */ |
||
427 | public $isQueryResultDocument = false; |
||
428 | |||
429 | /** |
||
430 | * READ-ONLY: Whether this class describes the mapping of a gridFS file |
||
431 | * |
||
432 | * @var bool |
||
433 | */ |
||
434 | public $isFile = false; |
||
435 | |||
436 | /** |
||
437 | * READ-ONLY: The policy used for change-tracking on entities of this class. |
||
438 | * |
||
439 | * @var int |
||
440 | */ |
||
441 | public $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT; |
||
442 | |||
443 | /** |
||
444 | * READ-ONLY: A flag for whether or not instances of this class are to be versioned |
||
445 | * with optimistic locking. |
||
446 | * |
||
447 | * @var bool $isVersioned |
||
448 | */ |
||
449 | public $isVersioned; |
||
450 | |||
451 | /** |
||
452 | * READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any). |
||
453 | * |
||
454 | * @var mixed $versionField |
||
455 | */ |
||
456 | public $versionField; |
||
457 | |||
458 | /** |
||
459 | * READ-ONLY: A flag for whether or not instances of this class are to allow pessimistic |
||
460 | * locking. |
||
461 | * |
||
462 | * @var bool $isLockable |
||
463 | */ |
||
464 | public $isLockable; |
||
465 | |||
466 | /** |
||
467 | * READ-ONLY: The name of the field which is used for locking a document. |
||
468 | * |
||
469 | * @var mixed $lockField |
||
470 | */ |
||
471 | public $lockField; |
||
472 | |||
473 | /** |
||
474 | * The ReflectionClass instance of the mapped class. |
||
475 | * |
||
476 | * @var \ReflectionClass |
||
477 | */ |
||
478 | public $reflClass; |
||
479 | |||
480 | /** |
||
481 | * READ_ONLY: A flag for whether or not this document is read-only. |
||
482 | * |
||
483 | * @var bool |
||
484 | */ |
||
485 | public $isReadOnly; |
||
486 | |||
487 | /** @var InstantiatorInterface|null */ |
||
488 | private $instantiator; |
||
489 | |||
490 | /** |
||
491 | * Initializes a new ClassMetadata instance that will hold the object-document mapping |
||
492 | * metadata of the class with the given name. |
||
493 | * |
||
494 | * @param string $documentName The name of the document class the new instance is used for. |
||
495 | */ |
||
496 | 1496 | public function __construct($documentName) |
|
505 | |||
506 | /** |
||
507 | * Helper method to get reference id of ref* type references |
||
508 | * @param mixed $reference |
||
509 | * @param string $storeAs |
||
510 | * @return mixed |
||
511 | * @internal |
||
512 | */ |
||
513 | 122 | public static function getReferenceId($reference, $storeAs) |
|
517 | |||
518 | /** |
||
519 | * Returns the reference prefix used for a reference |
||
520 | * @param string $storeAs |
||
521 | * @return string |
||
522 | */ |
||
523 | 187 | private static function getReferencePrefix($storeAs) |
|
531 | |||
532 | /** |
||
533 | * Returns a fully qualified field name for a given reference |
||
534 | * @param string $storeAs |
||
535 | * @param string $pathPrefix The field path prefix |
||
536 | * @return string |
||
537 | * @internal |
||
538 | */ |
||
539 | 134 | public static function getReferenceFieldName($storeAs, $pathPrefix = '') |
|
547 | |||
548 | /** |
||
549 | * {@inheritDoc} |
||
550 | */ |
||
551 | 1382 | public function getReflectionClass() |
|
559 | |||
560 | /** |
||
561 | * {@inheritDoc} |
||
562 | */ |
||
563 | 327 | public function isIdentifier($fieldName) |
|
567 | |||
568 | /** |
||
569 | * INTERNAL: |
||
570 | * Sets the mapped identifier field of this class. |
||
571 | * |
||
572 | * @param string $identifier |
||
573 | */ |
||
574 | 893 | public function setIdentifier($identifier) |
|
578 | |||
579 | /** |
||
580 | * {@inheritDoc} |
||
581 | * |
||
582 | * Since MongoDB only allows exactly one identifier field |
||
583 | * this will always return an array with only one value |
||
584 | */ |
||
585 | 39 | public function getIdentifier() |
|
589 | |||
590 | /** |
||
591 | * {@inheritDoc} |
||
592 | * |
||
593 | * Since MongoDB only allows exactly one identifier field |
||
594 | * this will always return an array with only one value |
||
595 | */ |
||
596 | 103 | public function getIdentifierFieldNames() |
|
600 | |||
601 | /** |
||
602 | * {@inheritDoc} |
||
603 | */ |
||
604 | 897 | public function hasField($fieldName) |
|
608 | |||
609 | /** |
||
610 | * Sets the inheritance type used by the class and it's subclasses. |
||
611 | * |
||
612 | * @param int $type |
||
613 | */ |
||
614 | 909 | public function setInheritanceType($type) |
|
618 | |||
619 | /** |
||
620 | * Checks whether a mapped field is inherited from an entity superclass. |
||
621 | * |
||
622 | * @param string $fieldName |
||
623 | * |
||
624 | * @return bool TRUE if the field is inherited, FALSE otherwise. |
||
625 | */ |
||
626 | 1378 | public function isInheritedField($fieldName) |
|
630 | |||
631 | /** |
||
632 | * Registers a custom repository class for the document class. |
||
633 | * |
||
634 | * @param string $repositoryClassName The class name of the custom repository. |
||
635 | */ |
||
636 | 841 | public function setCustomRepositoryClass($repositoryClassName) |
|
648 | |||
649 | /** |
||
650 | * Dispatches the lifecycle event of the given document by invoking all |
||
651 | * registered callbacks. |
||
652 | * |
||
653 | * @param string $event Lifecycle event |
||
654 | * @param object $document Document on which the event occurred |
||
655 | * @param array $arguments Arguments to pass to all callbacks |
||
656 | * @throws \InvalidArgumentException If document class is not this class or |
||
657 | * a Proxy of this class. |
||
658 | */ |
||
659 | 605 | public function invokeLifecycleCallbacks($event, $document, ?array $arguments = null) |
|
677 | |||
678 | /** |
||
679 | * Checks whether the class has callbacks registered for a lifecycle event. |
||
680 | * |
||
681 | * @param string $event Lifecycle event |
||
682 | * |
||
683 | * @return bool |
||
684 | */ |
||
685 | public function hasLifecycleCallbacks($event) |
||
689 | |||
690 | /** |
||
691 | * Gets the registered lifecycle callbacks for an event. |
||
692 | * |
||
693 | * @param string $event |
||
694 | * @return array |
||
695 | */ |
||
696 | public function getLifecycleCallbacks($event) |
||
700 | |||
701 | /** |
||
702 | * Adds a lifecycle callback for documents of this class. |
||
703 | * |
||
704 | * If the callback is already registered, this is a NOOP. |
||
705 | * |
||
706 | * @param string $callback |
||
707 | * @param string $event |
||
708 | */ |
||
709 | 808 | public function addLifecycleCallback($callback, $event) |
|
717 | |||
718 | /** |
||
719 | * Sets the lifecycle callbacks for documents of this class. |
||
720 | * |
||
721 | * Any previously registered callbacks are overwritten. |
||
722 | * |
||
723 | * @param array $callbacks |
||
724 | */ |
||
725 | 892 | public function setLifecycleCallbacks(array $callbacks) |
|
729 | |||
730 | /** |
||
731 | * Registers a method for loading document data before field hydration. |
||
732 | * |
||
733 | * Note: A method may be registered multiple times for different fields. |
||
734 | * it will be invoked only once for the first field found. |
||
735 | * |
||
736 | * @param string $method Method name |
||
737 | * @param array|string $fields Database field name(s) |
||
738 | */ |
||
739 | 14 | public function registerAlsoLoadMethod($method, $fields) |
|
743 | |||
744 | /** |
||
745 | * Sets the AlsoLoad methods for documents of this class. |
||
746 | * |
||
747 | * Any previously registered methods are overwritten. |
||
748 | * |
||
749 | * @param array $methods |
||
750 | */ |
||
751 | 892 | public function setAlsoLoadMethods(array $methods) |
|
755 | |||
756 | /** |
||
757 | * Sets the discriminator field. |
||
758 | * |
||
759 | * The field name is the the unmapped database field. Discriminator values |
||
760 | * are only used to discern the hydration class and are not mapped to class |
||
761 | * properties. |
||
762 | * |
||
763 | * @param string $discriminatorField |
||
764 | * |
||
765 | * @throws MappingException If the discriminator field conflicts with the |
||
766 | * "name" attribute of a mapped field. |
||
767 | */ |
||
768 | 918 | public function setDiscriminatorField($discriminatorField) |
|
797 | |||
798 | /** |
||
799 | * Sets the discriminator values used by this class. |
||
800 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies. |
||
801 | * |
||
802 | * @param array $map |
||
803 | * |
||
804 | * @throws MappingException |
||
805 | */ |
||
806 | 911 | public function setDiscriminatorMap(array $map) |
|
829 | |||
830 | /** |
||
831 | * Sets the default discriminator value to be used for this class |
||
832 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies if the document has no discriminator value |
||
833 | * |
||
834 | * @param string $defaultDiscriminatorValue |
||
835 | * |
||
836 | * @throws MappingException |
||
837 | */ |
||
838 | 895 | public function setDefaultDiscriminatorValue($defaultDiscriminatorValue) |
|
856 | |||
857 | /** |
||
858 | * Sets the discriminator value for this class. |
||
859 | * Used for JOINED/SINGLE_TABLE inheritance and multiple document types in a single |
||
860 | * collection. |
||
861 | * |
||
862 | * @param string $value |
||
863 | * |
||
864 | * @throws MappingException |
||
865 | */ |
||
866 | 3 | public function setDiscriminatorValue($value) |
|
875 | |||
876 | /** |
||
877 | * Add a index for this Document. |
||
878 | * |
||
879 | * @param array $keys Array of keys for the index. |
||
880 | * @param array $options Array of options for the index. |
||
881 | */ |
||
882 | 186 | public function addIndex($keys, array $options = []) |
|
904 | |||
905 | /** |
||
906 | * Returns the array of indexes for this Document. |
||
907 | * |
||
908 | * @return array $indexes The array of indexes. |
||
909 | */ |
||
910 | 24 | public function getIndexes() |
|
914 | |||
915 | /** |
||
916 | * Checks whether this document has indexes or not. |
||
917 | * |
||
918 | * @return bool |
||
919 | */ |
||
920 | public function hasIndexes() |
||
924 | |||
925 | /** |
||
926 | * Set shard key for this Document. |
||
927 | * |
||
928 | * @param array $keys Array of document keys. |
||
929 | * @param array $options Array of sharding options. |
||
930 | * |
||
931 | * @throws MappingException |
||
932 | */ |
||
933 | 74 | public function setShardKey(array $keys, array $options = []) |
|
977 | |||
978 | /** |
||
979 | * @return array |
||
980 | */ |
||
981 | 17 | public function getShardKey() |
|
985 | |||
986 | /** |
||
987 | * Checks whether this document has shard key or not. |
||
988 | * |
||
989 | * @return bool |
||
990 | */ |
||
991 | 1104 | public function isSharded() |
|
995 | |||
996 | /** |
||
997 | * Sets the read preference used by this class. |
||
998 | * |
||
999 | * @param string $readPreference |
||
1000 | * @param array|null $tags |
||
1001 | */ |
||
1002 | 892 | public function setReadPreference($readPreference, $tags) |
|
1007 | |||
1008 | /** |
||
1009 | * Sets the write concern used by this class. |
||
1010 | * |
||
1011 | * @param string $writeConcern |
||
1012 | */ |
||
1013 | 902 | public function setWriteConcern($writeConcern) |
|
1017 | |||
1018 | /** |
||
1019 | * @return string |
||
1020 | */ |
||
1021 | 11 | public function getWriteConcern() |
|
1025 | |||
1026 | /** |
||
1027 | * Whether there is a write concern configured for this class. |
||
1028 | * |
||
1029 | * @return bool |
||
1030 | */ |
||
1031 | 552 | public function hasWriteConcern() |
|
1035 | |||
1036 | /** |
||
1037 | * Sets the change tracking policy used by this class. |
||
1038 | * |
||
1039 | * @param int $policy |
||
1040 | */ |
||
1041 | 894 | public function setChangeTrackingPolicy($policy) |
|
1045 | |||
1046 | /** |
||
1047 | * Whether the change tracking policy of this class is "deferred explicit". |
||
1048 | * |
||
1049 | * @return bool |
||
1050 | */ |
||
1051 | 64 | public function isChangeTrackingDeferredExplicit() |
|
1055 | |||
1056 | /** |
||
1057 | * Whether the change tracking policy of this class is "deferred implicit". |
||
1058 | * |
||
1059 | * @return bool |
||
1060 | */ |
||
1061 | 574 | public function isChangeTrackingDeferredImplicit() |
|
1065 | |||
1066 | /** |
||
1067 | * Whether the change tracking policy of this class is "notify". |
||
1068 | * |
||
1069 | * @return bool |
||
1070 | */ |
||
1071 | 312 | public function isChangeTrackingNotify() |
|
1075 | |||
1076 | /** |
||
1077 | * Gets the ReflectionProperties of the mapped class. |
||
1078 | * |
||
1079 | * @return array An array of ReflectionProperty instances. |
||
1080 | */ |
||
1081 | 103 | public function getReflectionProperties() |
|
1085 | |||
1086 | /** |
||
1087 | * Gets a ReflectionProperty for a specific field of the mapped class. |
||
1088 | * |
||
1089 | * @param string $name |
||
1090 | * |
||
1091 | * @return \ReflectionProperty |
||
1092 | */ |
||
1093 | public function getReflectionProperty($name) |
||
1097 | |||
1098 | /** |
||
1099 | * {@inheritDoc} |
||
1100 | */ |
||
1101 | 1386 | public function getName() |
|
1105 | |||
1106 | /** |
||
1107 | * The namespace this Document class belongs to. |
||
1108 | * |
||
1109 | * @return string $namespace The namespace name. |
||
1110 | */ |
||
1111 | public function getNamespace() |
||
1115 | |||
1116 | /** |
||
1117 | * Returns the database this Document is mapped to. |
||
1118 | * |
||
1119 | * @return string $db The database name. |
||
1120 | */ |
||
1121 | 1308 | public function getDatabase() |
|
1125 | |||
1126 | /** |
||
1127 | * Set the database this Document is mapped to. |
||
1128 | * |
||
1129 | * @param string $db The database name |
||
1130 | */ |
||
1131 | 95 | public function setDatabase($db) |
|
1135 | |||
1136 | /** |
||
1137 | * Get the collection this Document is mapped to. |
||
1138 | * |
||
1139 | * @return string $collection The collection name. |
||
1140 | */ |
||
1141 | 1303 | public function getCollection() |
|
1145 | |||
1146 | /** |
||
1147 | * Sets the collection this Document is mapped to. |
||
1148 | * |
||
1149 | * @param array|string $name |
||
1150 | * |
||
1151 | * @throws \InvalidArgumentException |
||
1152 | */ |
||
1153 | 1496 | public function setCollection($name) |
|
1167 | |||
1168 | 15 | public function getBucketName(): ?string |
|
1172 | |||
1173 | 57 | public function setBucketName(string $bucketName): void |
|
1178 | |||
1179 | /** |
||
1180 | * Get whether or not the documents collection is capped. |
||
1181 | * |
||
1182 | * @return bool |
||
1183 | */ |
||
1184 | 5 | public function getCollectionCapped() |
|
1188 | |||
1189 | /** |
||
1190 | * Set whether or not the documents collection is capped. |
||
1191 | * |
||
1192 | * @param bool $bool |
||
1193 | */ |
||
1194 | 1 | public function setCollectionCapped($bool) |
|
1198 | |||
1199 | /** |
||
1200 | * Get the collection size |
||
1201 | * |
||
1202 | * @return int |
||
1203 | */ |
||
1204 | 5 | public function getCollectionSize() |
|
1208 | |||
1209 | /** |
||
1210 | * Set the collection size. |
||
1211 | * |
||
1212 | * @param int $size |
||
1213 | */ |
||
1214 | 1 | public function setCollectionSize($size) |
|
1218 | |||
1219 | /** |
||
1220 | * Get the collection max. |
||
1221 | * |
||
1222 | * @return int |
||
1223 | */ |
||
1224 | 5 | public function getCollectionMax() |
|
1228 | |||
1229 | /** |
||
1230 | * Set the collection max. |
||
1231 | * |
||
1232 | * @param int $max |
||
1233 | */ |
||
1234 | 1 | public function setCollectionMax($max) |
|
1238 | |||
1239 | /** |
||
1240 | * Returns TRUE if this Document is mapped to a collection FALSE otherwise. |
||
1241 | * |
||
1242 | * @return bool |
||
1243 | */ |
||
1244 | public function isMappedToCollection() |
||
1248 | |||
1249 | /** |
||
1250 | * Validates the storage strategy of a mapping for consistency |
||
1251 | * @param array $mapping |
||
1252 | * @throws MappingException |
||
1253 | */ |
||
1254 | 1405 | private function applyStorageStrategy(array &$mapping) |
|
1297 | |||
1298 | /** |
||
1299 | * Map a single embedded document. |
||
1300 | * |
||
1301 | * @param array $mapping The mapping information. |
||
1302 | */ |
||
1303 | 6 | public function mapOneEmbedded(array $mapping) |
|
1309 | |||
1310 | /** |
||
1311 | * Map a collection of embedded documents. |
||
1312 | * |
||
1313 | * @param array $mapping The mapping information. |
||
1314 | */ |
||
1315 | 5 | public function mapManyEmbedded(array $mapping) |
|
1321 | |||
1322 | /** |
||
1323 | * Map a single document reference. |
||
1324 | * |
||
1325 | * @param array $mapping The mapping information. |
||
1326 | */ |
||
1327 | 2 | public function mapOneReference(array $mapping) |
|
1333 | |||
1334 | /** |
||
1335 | * Map a collection of document references. |
||
1336 | * |
||
1337 | * @param array $mapping The mapping information. |
||
1338 | */ |
||
1339 | 1 | public function mapManyReference(array $mapping) |
|
1345 | |||
1346 | /** |
||
1347 | * INTERNAL: |
||
1348 | * Adds a field mapping without completing/validating it. |
||
1349 | * This is mainly used to add inherited field mappings to derived classes. |
||
1350 | * |
||
1351 | * @param array $fieldMapping |
||
1352 | */ |
||
1353 | 119 | public function addInheritedFieldMapping(array $fieldMapping) |
|
1363 | |||
1364 | /** |
||
1365 | * INTERNAL: |
||
1366 | * Adds an association mapping without completing/validating it. |
||
1367 | * This is mainly used to add inherited association mappings to derived classes. |
||
1368 | * |
||
1369 | * @param array $mapping |
||
1370 | * |
||
1371 | * |
||
1372 | * @throws MappingException |
||
1373 | */ |
||
1374 | 71 | public function addInheritedAssociationMapping(array $mapping/*, $owningClassName = null*/) |
|
1378 | |||
1379 | /** |
||
1380 | * Checks whether the class has a mapped association with the given field name. |
||
1381 | * |
||
1382 | * @param string $fieldName |
||
1383 | * @return bool |
||
1384 | */ |
||
1385 | 32 | public function hasReference($fieldName) |
|
1389 | |||
1390 | /** |
||
1391 | * Checks whether the class has a mapped embed with the given field name. |
||
1392 | * |
||
1393 | * @param string $fieldName |
||
1394 | * @return bool |
||
1395 | */ |
||
1396 | 5 | public function hasEmbed($fieldName) |
|
1400 | |||
1401 | /** |
||
1402 | * {@inheritDoc} |
||
1403 | * |
||
1404 | * Checks whether the class has a mapped association (embed or reference) with the given field name. |
||
1405 | */ |
||
1406 | 7 | public function hasAssociation($fieldName) |
|
1410 | |||
1411 | /** |
||
1412 | * {@inheritDoc} |
||
1413 | * |
||
1414 | * Checks whether the class has a mapped reference or embed for the specified field and |
||
1415 | * is a single valued association. |
||
1416 | */ |
||
1417 | public function isSingleValuedAssociation($fieldName) |
||
1421 | |||
1422 | /** |
||
1423 | * {@inheritDoc} |
||
1424 | * |
||
1425 | * Checks whether the class has a mapped reference or embed for the specified field and |
||
1426 | * is a collection valued association. |
||
1427 | */ |
||
1428 | public function isCollectionValuedAssociation($fieldName) |
||
1432 | |||
1433 | /** |
||
1434 | * Checks whether the class has a mapped association for the specified field |
||
1435 | * and if yes, checks whether it is a single-valued association (to-one). |
||
1436 | * |
||
1437 | * @param string $fieldName |
||
1438 | * @return bool TRUE if the association exists and is single-valued, FALSE otherwise. |
||
1439 | */ |
||
1440 | public function isSingleValuedReference($fieldName) |
||
1445 | |||
1446 | /** |
||
1447 | * Checks whether the class has a mapped association for the specified field |
||
1448 | * and if yes, checks whether it is a collection-valued association (to-many). |
||
1449 | * |
||
1450 | * @param string $fieldName |
||
1451 | * @return bool TRUE if the association exists and is collection-valued, FALSE otherwise. |
||
1452 | */ |
||
1453 | public function isCollectionValuedReference($fieldName) |
||
1458 | |||
1459 | /** |
||
1460 | * Checks whether the class has a mapped embedded document for the specified field |
||
1461 | * and if yes, checks whether it is a single-valued association (to-one). |
||
1462 | * |
||
1463 | * @param string $fieldName |
||
1464 | * @return bool TRUE if the association exists and is single-valued, FALSE otherwise. |
||
1465 | */ |
||
1466 | public function isSingleValuedEmbed($fieldName) |
||
1471 | |||
1472 | /** |
||
1473 | * Checks whether the class has a mapped embedded document for the specified field |
||
1474 | * and if yes, checks whether it is a collection-valued association (to-many). |
||
1475 | * |
||
1476 | * @param string $fieldName |
||
1477 | * @return bool TRUE if the association exists and is collection-valued, FALSE otherwise. |
||
1478 | */ |
||
1479 | public function isCollectionValuedEmbed($fieldName) |
||
1484 | |||
1485 | /** |
||
1486 | * Sets the ID generator used to generate IDs for instances of this class. |
||
1487 | * |
||
1488 | * @param AbstractIdGenerator $generator |
||
1489 | */ |
||
1490 | 1322 | public function setIdGenerator($generator) |
|
1494 | |||
1495 | /** |
||
1496 | * Casts the identifier to its portable PHP type. |
||
1497 | * |
||
1498 | * @param mixed $id |
||
1499 | * @return mixed $id |
||
1500 | */ |
||
1501 | 601 | public function getPHPIdentifierValue($id) |
|
1506 | |||
1507 | /** |
||
1508 | * Casts the identifier to its database type. |
||
1509 | * |
||
1510 | * @param mixed $id |
||
1511 | * @return mixed $id |
||
1512 | */ |
||
1513 | 664 | public function getDatabaseIdentifierValue($id) |
|
1518 | |||
1519 | /** |
||
1520 | * Sets the document identifier of a document. |
||
1521 | * |
||
1522 | * The value will be converted to a PHP type before being set. |
||
1523 | * |
||
1524 | * @param object $document |
||
1525 | * @param mixed $id |
||
1526 | */ |
||
1527 | 525 | public function setIdentifierValue($document, $id) |
|
1532 | |||
1533 | /** |
||
1534 | * Gets the document identifier as a PHP type. |
||
1535 | * |
||
1536 | * @param object $document |
||
1537 | * @return mixed $id |
||
1538 | */ |
||
1539 | 608 | public function getIdentifierValue($document) |
|
1543 | |||
1544 | /** |
||
1545 | * {@inheritDoc} |
||
1546 | * |
||
1547 | * Since MongoDB only allows exactly one identifier field this is a proxy |
||
1548 | * to {@see getIdentifierValue()} and returns an array with the identifier |
||
1549 | * field as a key. |
||
1550 | */ |
||
1551 | public function getIdentifierValues($object) |
||
1555 | |||
1556 | /** |
||
1557 | * Get the document identifier object as a database type. |
||
1558 | * |
||
1559 | * @param object $document |
||
1560 | * |
||
1561 | * @return ObjectId $id The ObjectId |
||
1562 | */ |
||
1563 | 31 | public function getIdentifierObject($document) |
|
1567 | |||
1568 | /** |
||
1569 | * Sets the specified field to the specified value on the given document. |
||
1570 | * |
||
1571 | * @param object $document |
||
1572 | * @param string $field |
||
1573 | * @param mixed $value |
||
1574 | */ |
||
1575 | 8 | public function setFieldValue($document, $field, $value) |
|
1585 | |||
1586 | /** |
||
1587 | * Gets the specified field's value off the given document. |
||
1588 | * |
||
1589 | * @param object $document |
||
1590 | * @param string $field |
||
1591 | * |
||
1592 | * @return mixed |
||
1593 | */ |
||
1594 | 27 | public function getFieldValue($document, $field) |
|
1602 | |||
1603 | /** |
||
1604 | * Gets the mapping of a field. |
||
1605 | * |
||
1606 | * @param string $fieldName The field name. |
||
1607 | * |
||
1608 | * @return array The field mapping. |
||
1609 | * |
||
1610 | * @throws MappingException If the $fieldName is not found in the fieldMappings array. |
||
1611 | */ |
||
1612 | 171 | public function getFieldMapping($fieldName) |
|
1619 | |||
1620 | /** |
||
1621 | * Gets mappings of fields holding embedded document(s). |
||
1622 | * |
||
1623 | * @return array of field mappings |
||
1624 | */ |
||
1625 | 563 | public function getEmbeddedFieldsMappings() |
|
1634 | |||
1635 | /** |
||
1636 | * Gets the field mapping by its DB name. |
||
1637 | * E.g. it returns identifier's mapping when called with _id. |
||
1638 | * |
||
1639 | * @param string $dbFieldName |
||
1640 | * |
||
1641 | * @return array |
||
1642 | * @throws MappingException |
||
1643 | */ |
||
1644 | 6 | public function getFieldMappingByDbFieldName($dbFieldName) |
|
1654 | |||
1655 | /** |
||
1656 | * Check if the field is not null. |
||
1657 | * |
||
1658 | * @param string $fieldName The field name |
||
1659 | * |
||
1660 | * @return bool TRUE if the field is not null, FALSE otherwise. |
||
1661 | */ |
||
1662 | 1 | public function isNullable($fieldName) |
|
1670 | |||
1671 | /** |
||
1672 | * Checks whether the document has a discriminator field and value configured. |
||
1673 | * |
||
1674 | * @return bool |
||
1675 | */ |
||
1676 | 503 | public function hasDiscriminator() |
|
1680 | |||
1681 | /** |
||
1682 | * Sets the type of Id generator to use for the mapped class. |
||
1683 | * |
||
1684 | * @param string $generatorType Generator type. |
||
1685 | */ |
||
1686 | 892 | public function setIdGeneratorType($generatorType) |
|
1690 | |||
1691 | /** |
||
1692 | * Sets the Id generator options. |
||
1693 | * |
||
1694 | * @param array $generatorOptions Generator options. |
||
1695 | */ |
||
1696 | public function setIdGeneratorOptions($generatorOptions) |
||
1700 | |||
1701 | /** |
||
1702 | * @return bool |
||
1703 | */ |
||
1704 | 571 | public function isInheritanceTypeNone() |
|
1708 | |||
1709 | /** |
||
1710 | * Checks whether the mapped class uses the SINGLE_COLLECTION inheritance mapping strategy. |
||
1711 | * |
||
1712 | * @return bool |
||
1713 | */ |
||
1714 | 891 | public function isInheritanceTypeSingleCollection() |
|
1718 | |||
1719 | /** |
||
1720 | * Checks whether the mapped class uses the COLLECTION_PER_CLASS inheritance mapping strategy. |
||
1721 | * |
||
1722 | * @return bool |
||
1723 | */ |
||
1724 | public function isInheritanceTypeCollectionPerClass() |
||
1728 | |||
1729 | /** |
||
1730 | * Sets the mapped subclasses of this class. |
||
1731 | * |
||
1732 | * @param string[] $subclasses The names of all mapped subclasses. |
||
1733 | */ |
||
1734 | 2 | public function setSubclasses(array $subclasses) |
|
1744 | |||
1745 | /** |
||
1746 | * Sets the parent class names. |
||
1747 | * Assumes that the class names in the passed array are in the order: |
||
1748 | * directParent -> directParentParent -> directParentParentParent ... -> root. |
||
1749 | * |
||
1750 | * @param string[] $classNames |
||
1751 | */ |
||
1752 | 1377 | public function setParentClasses(array $classNames) |
|
1762 | |||
1763 | /** |
||
1764 | * Checks whether the class will generate a new \MongoDB\BSON\ObjectId instance for us. |
||
1765 | * |
||
1766 | * @return bool TRUE if the class uses the AUTO generator, FALSE otherwise. |
||
1767 | */ |
||
1768 | public function isIdGeneratorAuto() |
||
1772 | |||
1773 | /** |
||
1774 | * Checks whether the class will use a collection to generate incremented identifiers. |
||
1775 | * |
||
1776 | * @return bool TRUE if the class uses the INCREMENT generator, FALSE otherwise. |
||
1777 | */ |
||
1778 | public function isIdGeneratorIncrement() |
||
1782 | |||
1783 | /** |
||
1784 | * Checks whether the class will generate a uuid id. |
||
1785 | * |
||
1786 | * @return bool TRUE if the class uses the UUID generator, FALSE otherwise. |
||
1787 | */ |
||
1788 | public function isIdGeneratorUuid() |
||
1792 | |||
1793 | /** |
||
1794 | * Checks whether the class uses no id generator. |
||
1795 | * |
||
1796 | * @return bool TRUE if the class does not use any id generator, FALSE otherwise. |
||
1797 | */ |
||
1798 | public function isIdGeneratorNone() |
||
1802 | |||
1803 | /** |
||
1804 | * Sets the version field mapping used for versioning. Sets the default |
||
1805 | * value to use depending on the column type. |
||
1806 | * |
||
1807 | * @param array $mapping The version field mapping array |
||
1808 | * |
||
1809 | * @throws LockException |
||
1810 | */ |
||
1811 | 70 | public function setVersionMapping(array &$mapping) |
|
1820 | |||
1821 | /** |
||
1822 | * Sets whether this class is to be versioned for optimistic locking. |
||
1823 | * |
||
1824 | * @param bool $bool |
||
1825 | */ |
||
1826 | 892 | public function setVersioned($bool) |
|
1830 | |||
1831 | /** |
||
1832 | * Sets the name of the field that is to be used for versioning if this class is |
||
1833 | * versioned for optimistic locking. |
||
1834 | * |
||
1835 | * @param string $versionField |
||
1836 | */ |
||
1837 | 892 | public function setVersionField($versionField) |
|
1841 | |||
1842 | /** |
||
1843 | * Sets the version field mapping used for versioning. Sets the default |
||
1844 | * value to use depending on the column type. |
||
1845 | * |
||
1846 | * @param array $mapping The version field mapping array |
||
1847 | * |
||
1848 | * @throws LockException |
||
1849 | */ |
||
1850 | 22 | public function setLockMapping(array &$mapping) |
|
1859 | |||
1860 | /** |
||
1861 | * Sets whether this class is to allow pessimistic locking. |
||
1862 | * |
||
1863 | * @param bool $bool |
||
1864 | */ |
||
1865 | public function setLockable($bool) |
||
1869 | |||
1870 | /** |
||
1871 | * Sets the name of the field that is to be used for storing whether a document |
||
1872 | * is currently locked or not. |
||
1873 | * |
||
1874 | * @param string $lockField |
||
1875 | */ |
||
1876 | public function setLockField($lockField) |
||
1880 | |||
1881 | /** |
||
1882 | * Marks this class as read only, no change tracking is applied to it. |
||
1883 | */ |
||
1884 | 5 | public function markReadOnly() |
|
1888 | |||
1889 | /** |
||
1890 | * {@inheritDoc} |
||
1891 | */ |
||
1892 | public function getFieldNames() |
||
1896 | |||
1897 | /** |
||
1898 | * {@inheritDoc} |
||
1899 | */ |
||
1900 | public function getAssociationNames() |
||
1904 | |||
1905 | /** |
||
1906 | * {@inheritDoc} |
||
1907 | */ |
||
1908 | 23 | public function getTypeOfField($fieldName) |
|
1913 | |||
1914 | /** |
||
1915 | * {@inheritDoc} |
||
1916 | */ |
||
1917 | 4 | public function getAssociationTargetClass($assocName) |
|
1925 | |||
1926 | /** |
||
1927 | * Retrieve the collectionClass associated with an association |
||
1928 | * |
||
1929 | * @param string $assocName |
||
1930 | */ |
||
1931 | 1 | public function getAssociationCollectionClass($assocName) |
|
1943 | |||
1944 | /** |
||
1945 | * {@inheritDoc} |
||
1946 | */ |
||
1947 | public function isAssociationInverseSide($fieldName) |
||
1951 | |||
1952 | /** |
||
1953 | * {@inheritDoc} |
||
1954 | */ |
||
1955 | public function getAssociationMappedByTargetField($fieldName) |
||
1959 | |||
1960 | /** |
||
1961 | * Map a field. |
||
1962 | * |
||
1963 | * @param array $mapping The mapping information. |
||
1964 | * |
||
1965 | * @return array |
||
1966 | * |
||
1967 | * @throws MappingException |
||
1968 | */ |
||
1969 | 1421 | public function mapField(array $mapping) |
|
2146 | |||
2147 | /** |
||
2148 | * Determines which fields get serialized. |
||
2149 | * |
||
2150 | * It is only serialized what is necessary for best unserialization performance. |
||
2151 | * That means any metadata properties that are not set or empty or simply have |
||
2152 | * their default value are NOT serialized. |
||
2153 | * |
||
2154 | * Parts that are also NOT serialized because they can not be properly unserialized: |
||
2155 | * - reflClass (ReflectionClass) |
||
2156 | * - reflFields (ReflectionProperty array) |
||
2157 | * |
||
2158 | * @return array The names of all the fields that should be serialized. |
||
2159 | */ |
||
2160 | 6 | public function __sleep() |
|
2239 | |||
2240 | /** |
||
2241 | * Restores some state that can not be serialized/unserialized. |
||
2242 | * |
||
2243 | */ |
||
2244 | 6 | public function __wakeup() |
|
2260 | |||
2261 | /** |
||
2262 | * Creates a new instance of the mapped class, without invoking the constructor. |
||
2263 | * |
||
2264 | * @return object |
||
2265 | */ |
||
2266 | 358 | public function newInstance() |
|
2270 | |||
2271 | 59 | private function isAllowedGridFSField(string $name): bool |
|
2275 | } |
||
2276 |
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..