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 |
||
51 | class ClassMetadata implements BaseClassMetadata |
||
52 | { |
||
53 | /* The Id generator types. */ |
||
54 | /** |
||
55 | * AUTO means Doctrine will automatically create a new \MongoDB\BSON\ObjectId instance for us. |
||
56 | */ |
||
57 | public const GENERATOR_TYPE_AUTO = 1; |
||
58 | |||
59 | /** |
||
60 | * INCREMENT means a separate collection is used for maintaining and incrementing id generation. |
||
61 | * Offers full portability. |
||
62 | */ |
||
63 | public const GENERATOR_TYPE_INCREMENT = 2; |
||
64 | |||
65 | /** |
||
66 | * UUID means Doctrine will generate a uuid for us. |
||
67 | */ |
||
68 | public const GENERATOR_TYPE_UUID = 3; |
||
69 | |||
70 | /** |
||
71 | * ALNUM means Doctrine will generate Alpha-numeric string identifiers, using the INCREMENT |
||
72 | * generator to ensure identifier uniqueness |
||
73 | */ |
||
74 | public const GENERATOR_TYPE_ALNUM = 4; |
||
75 | |||
76 | /** |
||
77 | * CUSTOM means Doctrine expect a class parameter. It will then try to initiate that class |
||
78 | * and pass other options to the generator. It will throw an Exception if the class |
||
79 | * does not exist or if an option was passed for that there is not setter in the new |
||
80 | * generator class. |
||
81 | * |
||
82 | * The class will have to be a subtype of AbstractIdGenerator. |
||
83 | */ |
||
84 | public const GENERATOR_TYPE_CUSTOM = 5; |
||
85 | |||
86 | /** |
||
87 | * NONE means Doctrine will not generate any id for us and you are responsible for manually |
||
88 | * assigning an id. |
||
89 | */ |
||
90 | public const GENERATOR_TYPE_NONE = 6; |
||
91 | |||
92 | /** |
||
93 | * Default discriminator field name. |
||
94 | * |
||
95 | * This is used for associations value for associations where a that do not define a "targetDocument" or |
||
96 | * "discriminatorField" option in their mapping. |
||
97 | */ |
||
98 | public const DEFAULT_DISCRIMINATOR_FIELD = '_doctrine_class_name'; |
||
99 | |||
100 | public const REFERENCE_ONE = 1; |
||
101 | public const REFERENCE_MANY = 2; |
||
102 | public const EMBED_ONE = 3; |
||
103 | public const EMBED_MANY = 4; |
||
104 | public const MANY = 'many'; |
||
105 | public const ONE = 'one'; |
||
106 | |||
107 | /** |
||
108 | * The types of storeAs references |
||
109 | */ |
||
110 | public const REFERENCE_STORE_AS_ID = 'id'; |
||
111 | public const REFERENCE_STORE_AS_DB_REF = 'dbRef'; |
||
112 | public const REFERENCE_STORE_AS_DB_REF_WITH_DB = 'dbRefWithDb'; |
||
113 | public const REFERENCE_STORE_AS_REF = 'ref'; |
||
114 | |||
115 | /* The inheritance mapping types */ |
||
116 | /** |
||
117 | * NONE means the class does not participate in an inheritance hierarchy |
||
118 | * and therefore does not need an inheritance mapping type. |
||
119 | */ |
||
120 | public const INHERITANCE_TYPE_NONE = 1; |
||
121 | |||
122 | /** |
||
123 | * SINGLE_COLLECTION means the class will be persisted according to the rules of |
||
124 | * <tt>Single Collection Inheritance</tt>. |
||
125 | */ |
||
126 | public const INHERITANCE_TYPE_SINGLE_COLLECTION = 2; |
||
127 | |||
128 | /** |
||
129 | * COLLECTION_PER_CLASS means the class will be persisted according to the rules |
||
130 | * of <tt>Concrete Collection Inheritance</tt>. |
||
131 | */ |
||
132 | public const INHERITANCE_TYPE_COLLECTION_PER_CLASS = 3; |
||
133 | |||
134 | /** |
||
135 | * DEFERRED_IMPLICIT means that changes of entities are calculated at commit-time |
||
136 | * by doing a property-by-property comparison with the original data. This will |
||
137 | * be done for all entities that are in MANAGED state at commit-time. |
||
138 | * |
||
139 | * This is the default change tracking policy. |
||
140 | */ |
||
141 | public const CHANGETRACKING_DEFERRED_IMPLICIT = 1; |
||
142 | |||
143 | /** |
||
144 | * DEFERRED_EXPLICIT means that changes of entities are calculated at commit-time |
||
145 | * by doing a property-by-property comparison with the original data. This will |
||
146 | * be done only for entities that were explicitly saved (through persist() or a cascade). |
||
147 | */ |
||
148 | public const CHANGETRACKING_DEFERRED_EXPLICIT = 2; |
||
149 | |||
150 | /** |
||
151 | * NOTIFY means that Doctrine relies on the entities sending out notifications |
||
152 | * when their properties change. Such entity classes must implement |
||
153 | * the <tt>NotifyPropertyChanged</tt> interface. |
||
154 | */ |
||
155 | public const CHANGETRACKING_NOTIFY = 3; |
||
156 | |||
157 | /** |
||
158 | * SET means that fields will be written to the database using a $set operator |
||
159 | */ |
||
160 | public const STORAGE_STRATEGY_SET = 'set'; |
||
161 | |||
162 | /** |
||
163 | * INCREMENT means that fields will be written to the database by calculating |
||
164 | * the difference and using the $inc operator |
||
165 | */ |
||
166 | public const STORAGE_STRATEGY_INCREMENT = 'increment'; |
||
167 | |||
168 | public const STORAGE_STRATEGY_PUSH_ALL = 'pushAll'; |
||
169 | public const STORAGE_STRATEGY_ADD_TO_SET = 'addToSet'; |
||
170 | public const STORAGE_STRATEGY_ATOMIC_SET = 'atomicSet'; |
||
171 | public const STORAGE_STRATEGY_ATOMIC_SET_ARRAY = 'atomicSetArray'; |
||
172 | public const STORAGE_STRATEGY_SET_ARRAY = 'setArray'; |
||
173 | |||
174 | private const ALLOWED_GRIDFS_FIELDS = ['_id', 'chunkSize', 'filename', 'length', 'metadata', 'uploadDate']; |
||
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: The name of the GridFS bucket the document is mapped to. |
||
190 | * @var string|null |
||
191 | */ |
||
192 | public $bucketName; |
||
193 | |||
194 | /** |
||
195 | * READ-ONLY: If the collection should be a fixed size. |
||
196 | * @var bool |
||
197 | */ |
||
198 | public $collectionCapped; |
||
199 | |||
200 | /** |
||
201 | * READ-ONLY: If the collection is fixed size, its size in bytes. |
||
202 | * @var int|null |
||
203 | */ |
||
204 | public $collectionSize; |
||
205 | |||
206 | /** |
||
207 | * READ-ONLY: If the collection is fixed size, the maximum number of elements to store in the collection. |
||
208 | * @var int|null |
||
209 | */ |
||
210 | public $collectionMax; |
||
211 | |||
212 | /** |
||
213 | * READ-ONLY Describes how MongoDB clients route read operations to the members of a replica set. |
||
214 | * @var string|int|null |
||
215 | */ |
||
216 | public $readPreference; |
||
217 | |||
218 | /** |
||
219 | * READ-ONLY Associated with readPreference Allows to specify criteria so that your application can target read |
||
220 | * operations to specific members, based on custom parameters. |
||
221 | * @var string[][]|null |
||
222 | */ |
||
223 | public $readPreferenceTags; |
||
224 | |||
225 | /** |
||
226 | * READ-ONLY: Describes the level of acknowledgement requested from MongoDB for write operations. |
||
227 | * @var string|int|null |
||
228 | */ |
||
229 | public $writeConcern; |
||
230 | |||
231 | /** |
||
232 | * READ-ONLY: The field name of the document identifier. |
||
233 | * @var string|null |
||
234 | */ |
||
235 | public $identifier; |
||
236 | |||
237 | /** |
||
238 | * READ-ONLY: The array of indexes for the document collection. |
||
239 | * @var array |
||
240 | */ |
||
241 | public $indexes = []; |
||
242 | |||
243 | /** |
||
244 | * READ-ONLY: Keys and options describing shard key. Only for sharded collections. |
||
245 | * @var string|null |
||
246 | */ |
||
247 | public $shardKey; |
||
248 | |||
249 | /** |
||
250 | * READ-ONLY: The name of the document class. |
||
251 | * @var string |
||
252 | */ |
||
253 | public $name; |
||
254 | |||
255 | /** |
||
256 | * READ-ONLY: The name of the document class that is at the root of the mapped document inheritance |
||
257 | * hierarchy. If the document is not part of a mapped inheritance hierarchy this is the same |
||
258 | * as {@link $documentName}. |
||
259 | * |
||
260 | * @var string |
||
261 | */ |
||
262 | public $rootDocumentName; |
||
263 | |||
264 | /** |
||
265 | * The name of the custom repository class used for the document class. |
||
266 | * (Optional). |
||
267 | * |
||
268 | * @var string |
||
269 | */ |
||
270 | public $customRepositoryClassName; |
||
271 | |||
272 | /** |
||
273 | * READ-ONLY: The names of the parent classes (ancestors). |
||
274 | * |
||
275 | * @var array |
||
276 | */ |
||
277 | public $parentClasses = []; |
||
278 | |||
279 | /** |
||
280 | * READ-ONLY: The names of all subclasses (descendants). |
||
281 | * |
||
282 | * @var array |
||
283 | */ |
||
284 | public $subClasses = []; |
||
285 | |||
286 | /** |
||
287 | * The ReflectionProperty instances of the mapped class. |
||
288 | * |
||
289 | * @var \ReflectionProperty[] |
||
290 | */ |
||
291 | public $reflFields = []; |
||
292 | |||
293 | /** |
||
294 | * READ-ONLY: The inheritance mapping type used by the class. |
||
295 | * |
||
296 | * @var int |
||
297 | */ |
||
298 | public $inheritanceType = self::INHERITANCE_TYPE_NONE; |
||
299 | |||
300 | /** |
||
301 | * READ-ONLY: The Id generator type used by the class. |
||
302 | * |
||
303 | * @var string |
||
304 | */ |
||
305 | public $generatorType = self::GENERATOR_TYPE_AUTO; |
||
306 | |||
307 | /** |
||
308 | * READ-ONLY: The Id generator options. |
||
309 | * |
||
310 | * @var array |
||
311 | */ |
||
312 | public $generatorOptions = []; |
||
313 | |||
314 | /** |
||
315 | * READ-ONLY: The ID generator used for generating IDs for this class. |
||
316 | * |
||
317 | * @var AbstractIdGenerator |
||
318 | */ |
||
319 | public $idGenerator; |
||
320 | |||
321 | /** |
||
322 | * READ-ONLY: The field mappings of the class. |
||
323 | * Keys are field names and values are mapping definitions. |
||
324 | * |
||
325 | * The mapping definition array has the following values: |
||
326 | * |
||
327 | * - <b>fieldName</b> (string) |
||
328 | * The name of the field in the Document. |
||
329 | * |
||
330 | * - <b>id</b> (boolean, optional) |
||
331 | * Marks the field as the primary key of the document. Multiple fields of an |
||
332 | * document can have the id attribute, forming a composite key. |
||
333 | * |
||
334 | * @var array |
||
335 | */ |
||
336 | public $fieldMappings = []; |
||
337 | |||
338 | /** |
||
339 | * READ-ONLY: The association mappings of the class. |
||
340 | * Keys are field names and values are mapping definitions. |
||
341 | * |
||
342 | * @var array |
||
343 | */ |
||
344 | public $associationMappings = []; |
||
345 | |||
346 | /** |
||
347 | * READ-ONLY: Array of fields to also load with a given method. |
||
348 | * |
||
349 | * @var array |
||
350 | */ |
||
351 | public $alsoLoadMethods = []; |
||
352 | |||
353 | /** |
||
354 | * READ-ONLY: The registered lifecycle callbacks for documents of this class. |
||
355 | * |
||
356 | * @var array |
||
357 | */ |
||
358 | public $lifecycleCallbacks = []; |
||
359 | |||
360 | /** |
||
361 | * READ-ONLY: The discriminator value of this class. |
||
362 | * |
||
363 | * <b>This does only apply to the JOINED and SINGLE_COLLECTION inheritance mapping strategies |
||
364 | * where a discriminator field is used.</b> |
||
365 | * |
||
366 | * @var mixed |
||
367 | * @see discriminatorField |
||
368 | */ |
||
369 | public $discriminatorValue; |
||
370 | |||
371 | /** |
||
372 | * READ-ONLY: The discriminator map of all mapped classes in the hierarchy. |
||
373 | * |
||
374 | * <b>This does only apply to the SINGLE_COLLECTION inheritance mapping strategy |
||
375 | * where a discriminator field is used.</b> |
||
376 | * |
||
377 | * @var mixed |
||
378 | * @see discriminatorField |
||
379 | */ |
||
380 | public $discriminatorMap = []; |
||
381 | |||
382 | /** |
||
383 | * READ-ONLY: The definition of the discriminator field used in SINGLE_COLLECTION |
||
384 | * inheritance mapping. |
||
385 | * |
||
386 | * @var string |
||
387 | */ |
||
388 | public $discriminatorField; |
||
389 | |||
390 | /** |
||
391 | * READ-ONLY: The default value for discriminatorField in case it's not set in the document |
||
392 | * |
||
393 | * @var string |
||
394 | * @see discriminatorField |
||
395 | */ |
||
396 | public $defaultDiscriminatorValue; |
||
397 | |||
398 | /** |
||
399 | * READ-ONLY: Whether this class describes the mapping of a mapped superclass. |
||
400 | * |
||
401 | * @var bool |
||
402 | */ |
||
403 | public $isMappedSuperclass = false; |
||
404 | |||
405 | /** |
||
406 | * READ-ONLY: Whether this class describes the mapping of a embedded document. |
||
407 | * |
||
408 | * @var bool |
||
409 | */ |
||
410 | public $isEmbeddedDocument = false; |
||
411 | |||
412 | /** |
||
413 | * READ-ONLY: Whether this class describes the mapping of an aggregation result document. |
||
414 | * |
||
415 | * @var bool |
||
416 | */ |
||
417 | public $isQueryResultDocument = false; |
||
418 | |||
419 | /** |
||
420 | * READ-ONLY: Whether this class describes the mapping of a gridFS file |
||
421 | * |
||
422 | * @var bool |
||
423 | */ |
||
424 | public $isFile = false; |
||
425 | |||
426 | /** |
||
427 | * READ-ONLY: The default chunk size in bytes for the file |
||
428 | * |
||
429 | * @var int|null |
||
430 | */ |
||
431 | public $chunkSizeBytes; |
||
432 | |||
433 | /** |
||
434 | * READ-ONLY: The policy used for change-tracking on entities of this class. |
||
435 | * |
||
436 | * @var int |
||
437 | */ |
||
438 | public $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT; |
||
439 | |||
440 | /** |
||
441 | * READ-ONLY: A flag for whether or not instances of this class are to be versioned |
||
442 | * with optimistic locking. |
||
443 | * |
||
444 | * @var bool $isVersioned |
||
445 | */ |
||
446 | public $isVersioned; |
||
447 | |||
448 | /** |
||
449 | * READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any). |
||
450 | * |
||
451 | * @var mixed $versionField |
||
452 | */ |
||
453 | public $versionField; |
||
454 | |||
455 | /** |
||
456 | * READ-ONLY: A flag for whether or not instances of this class are to allow pessimistic |
||
457 | * locking. |
||
458 | * |
||
459 | * @var bool $isLockable |
||
460 | */ |
||
461 | public $isLockable; |
||
462 | |||
463 | /** |
||
464 | * READ-ONLY: The name of the field which is used for locking a document. |
||
465 | * |
||
466 | * @var mixed $lockField |
||
467 | */ |
||
468 | public $lockField; |
||
469 | |||
470 | /** |
||
471 | * The ReflectionClass instance of the mapped class. |
||
472 | * |
||
473 | * @var \ReflectionClass |
||
474 | */ |
||
475 | public $reflClass; |
||
476 | |||
477 | /** |
||
478 | * READ_ONLY: A flag for whether or not this document is read-only. |
||
479 | * |
||
480 | * @var bool |
||
481 | */ |
||
482 | public $isReadOnly; |
||
483 | |||
484 | /** @var InstantiatorInterface|null */ |
||
485 | private $instantiator; |
||
486 | |||
487 | /** |
||
488 | * Initializes a new ClassMetadata instance that will hold the object-document mapping |
||
489 | * metadata of the class with the given name. |
||
490 | * |
||
491 | * @param string $documentName The name of the document class the new instance is used for. |
||
492 | */ |
||
493 | 1520 | public function __construct($documentName) |
|
501 | |||
502 | /** |
||
503 | * Helper method to get reference id of ref* type references |
||
504 | * @param mixed $reference |
||
505 | * @param string $storeAs |
||
506 | * @return mixed |
||
507 | * @internal |
||
508 | */ |
||
509 | 122 | public static function getReferenceId($reference, $storeAs) |
|
513 | |||
514 | /** |
||
515 | * Returns the reference prefix used for a reference |
||
516 | * @param string $storeAs |
||
517 | * @return string |
||
518 | */ |
||
519 | 187 | private static function getReferencePrefix($storeAs) |
|
527 | |||
528 | /** |
||
529 | * Returns a fully qualified field name for a given reference |
||
530 | * @param string $storeAs |
||
531 | * @param string $pathPrefix The field path prefix |
||
532 | * @return string |
||
533 | * @internal |
||
534 | */ |
||
535 | 134 | public static function getReferenceFieldName($storeAs, $pathPrefix = '') |
|
543 | |||
544 | /** |
||
545 | * {@inheritDoc} |
||
546 | */ |
||
547 | 1405 | public function getReflectionClass() |
|
555 | |||
556 | /** |
||
557 | * {@inheritDoc} |
||
558 | */ |
||
559 | 331 | public function isIdentifier($fieldName) |
|
563 | |||
564 | /** |
||
565 | * INTERNAL: |
||
566 | * Sets the mapped identifier field of this class. |
||
567 | * |
||
568 | * @param string $identifier |
||
569 | */ |
||
570 | 912 | public function setIdentifier($identifier) |
|
574 | |||
575 | /** |
||
576 | * {@inheritDoc} |
||
577 | * |
||
578 | * Since MongoDB only allows exactly one identifier field |
||
579 | * this will always return an array with only one value |
||
580 | */ |
||
581 | 39 | public function getIdentifier() |
|
585 | |||
586 | /** |
||
587 | * {@inheritDoc} |
||
588 | * |
||
589 | * Since MongoDB only allows exactly one identifier field |
||
590 | * this will always return an array with only one value |
||
591 | */ |
||
592 | 105 | public function getIdentifierFieldNames() |
|
596 | |||
597 | /** |
||
598 | * {@inheritDoc} |
||
599 | */ |
||
600 | 901 | public function hasField($fieldName) |
|
604 | |||
605 | /** |
||
606 | * Sets the inheritance type used by the class and it's subclasses. |
||
607 | * |
||
608 | * @param int $type |
||
609 | */ |
||
610 | 928 | public function setInheritanceType($type) |
|
614 | |||
615 | /** |
||
616 | * Checks whether a mapped field is inherited from an entity superclass. |
||
617 | * |
||
618 | * @param string $fieldName |
||
619 | * |
||
620 | * @return bool TRUE if the field is inherited, FALSE otherwise. |
||
621 | */ |
||
622 | 1401 | public function isInheritedField($fieldName) |
|
626 | |||
627 | /** |
||
628 | * Registers a custom repository class for the document class. |
||
629 | * |
||
630 | * @param string $repositoryClassName The class name of the custom repository. |
||
631 | */ |
||
632 | 860 | public function setCustomRepositoryClass($repositoryClassName) |
|
640 | |||
641 | /** |
||
642 | * Dispatches the lifecycle event of the given document by invoking all |
||
643 | * registered callbacks. |
||
644 | * |
||
645 | * @param string $event Lifecycle event |
||
646 | * @param object $document Document on which the event occurred |
||
647 | * @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 | */ |
||
651 | 607 | 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 | * Adds a lifecycle callback for documents of this class. |
||
695 | * |
||
696 | * If the callback is already registered, this is a NOOP. |
||
697 | * |
||
698 | * @param string $callback |
||
699 | * @param string $event |
||
700 | */ |
||
701 | 827 | public function addLifecycleCallback($callback, $event) |
|
709 | |||
710 | /** |
||
711 | * Sets the lifecycle callbacks for documents of this class. |
||
712 | * |
||
713 | * Any previously registered callbacks are overwritten. |
||
714 | * |
||
715 | * @param array $callbacks |
||
716 | */ |
||
717 | 911 | public function setLifecycleCallbacks(array $callbacks) |
|
721 | |||
722 | /** |
||
723 | * Registers a method for loading document data before field hydration. |
||
724 | * |
||
725 | * Note: A method may be registered multiple times for different fields. |
||
726 | * it will be invoked only once for the first field found. |
||
727 | * |
||
728 | * @param string $method Method name |
||
729 | * @param array|string $fields Database field name(s) |
||
730 | */ |
||
731 | 14 | public function registerAlsoLoadMethod($method, $fields) |
|
735 | |||
736 | /** |
||
737 | * Sets the AlsoLoad methods for documents of this class. |
||
738 | * |
||
739 | * Any previously registered methods are overwritten. |
||
740 | * |
||
741 | * @param array $methods |
||
742 | */ |
||
743 | 911 | 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 | * properties. |
||
754 | * |
||
755 | * @param string $discriminatorField |
||
756 | * |
||
757 | * @throws MappingException If the discriminator field conflicts with the |
||
758 | * "name" attribute of a mapped field. |
||
759 | */ |
||
760 | 937 | public function setDiscriminatorField($discriminatorField) |
|
789 | |||
790 | /** |
||
791 | * Sets the discriminator values used by this class. |
||
792 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies. |
||
793 | * |
||
794 | * @param array $map |
||
795 | * |
||
796 | * @throws MappingException |
||
797 | */ |
||
798 | 930 | public function setDiscriminatorMap(array $map) |
|
818 | |||
819 | /** |
||
820 | * Sets the default discriminator value to be used for this class |
||
821 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies if the document has no discriminator value |
||
822 | * |
||
823 | * @param string $defaultDiscriminatorValue |
||
824 | * |
||
825 | * @throws MappingException |
||
826 | */ |
||
827 | 914 | public function setDefaultDiscriminatorValue($defaultDiscriminatorValue) |
|
845 | |||
846 | /** |
||
847 | * Sets the discriminator value for this class. |
||
848 | * Used for JOINED/SINGLE_TABLE inheritance and multiple document types in a single |
||
849 | * collection. |
||
850 | * |
||
851 | * @param string $value |
||
852 | * |
||
853 | * @throws MappingException |
||
854 | */ |
||
855 | 3 | public function setDiscriminatorValue($value) |
|
864 | |||
865 | /** |
||
866 | * Add a index for this Document. |
||
867 | * |
||
868 | * @param array $keys Array of keys for the index. |
||
869 | * @param array $options Array of options for the index. |
||
870 | */ |
||
871 | 202 | public function addIndex($keys, array $options = []) |
|
893 | |||
894 | /** |
||
895 | * Returns the array of indexes for this Document. |
||
896 | * |
||
897 | * @return array $indexes The array of indexes. |
||
898 | */ |
||
899 | 23 | public function getIndexes() |
|
903 | |||
904 | /** |
||
905 | * Checks whether this document has indexes or not. |
||
906 | * |
||
907 | * @return bool |
||
908 | */ |
||
909 | public function hasIndexes() |
||
913 | |||
914 | /** |
||
915 | * Set shard key for this Document. |
||
916 | * |
||
917 | * @param array $keys Array of document keys. |
||
918 | * @param array $options Array of sharding options. |
||
919 | * |
||
920 | * @throws MappingException |
||
921 | */ |
||
922 | 91 | public function setShardKey(array $keys, array $options = []) |
|
966 | |||
967 | /** |
||
968 | * @return array |
||
969 | */ |
||
970 | 17 | public function getShardKey() |
|
974 | |||
975 | /** |
||
976 | * Checks whether this document has shard key or not. |
||
977 | * |
||
978 | * @return bool |
||
979 | */ |
||
980 | 1123 | public function isSharded() |
|
984 | |||
985 | /** |
||
986 | * Sets the read preference used by this class. |
||
987 | * |
||
988 | * @param string $readPreference |
||
989 | * @param array|null $tags |
||
990 | */ |
||
991 | 911 | public function setReadPreference($readPreference, $tags) |
|
996 | |||
997 | /** |
||
998 | * Sets the write concern used by this class. |
||
999 | * |
||
1000 | * @param string $writeConcern |
||
1001 | */ |
||
1002 | 921 | public function setWriteConcern($writeConcern) |
|
1006 | |||
1007 | /** |
||
1008 | * @return string |
||
1009 | */ |
||
1010 | 11 | public function getWriteConcern() |
|
1014 | |||
1015 | /** |
||
1016 | * Whether there is a write concern configured for this class. |
||
1017 | * |
||
1018 | * @return bool |
||
1019 | */ |
||
1020 | 554 | public function hasWriteConcern() |
|
1024 | |||
1025 | /** |
||
1026 | * Sets the change tracking policy used by this class. |
||
1027 | * |
||
1028 | * @param int $policy |
||
1029 | */ |
||
1030 | 913 | public function setChangeTrackingPolicy($policy) |
|
1034 | |||
1035 | /** |
||
1036 | * Whether the change tracking policy of this class is "deferred explicit". |
||
1037 | * |
||
1038 | * @return bool |
||
1039 | */ |
||
1040 | 64 | public function isChangeTrackingDeferredExplicit() |
|
1044 | |||
1045 | /** |
||
1046 | * Whether the change tracking policy of this class is "deferred implicit". |
||
1047 | * |
||
1048 | * @return bool |
||
1049 | */ |
||
1050 | 577 | public function isChangeTrackingDeferredImplicit() |
|
1054 | |||
1055 | /** |
||
1056 | * Whether the change tracking policy of this class is "notify". |
||
1057 | * |
||
1058 | * @return bool |
||
1059 | */ |
||
1060 | 315 | public function isChangeTrackingNotify() |
|
1064 | |||
1065 | /** |
||
1066 | * Gets the ReflectionProperties of the mapped class. |
||
1067 | * |
||
1068 | * @return array An array of ReflectionProperty instances. |
||
1069 | */ |
||
1070 | 105 | public function getReflectionProperties() |
|
1074 | |||
1075 | /** |
||
1076 | * Gets a ReflectionProperty for a specific field of the mapped class. |
||
1077 | * |
||
1078 | * @param string $name |
||
1079 | * |
||
1080 | * @return \ReflectionProperty |
||
1081 | */ |
||
1082 | public function getReflectionProperty($name) |
||
1086 | |||
1087 | /** |
||
1088 | * {@inheritDoc} |
||
1089 | */ |
||
1090 | 1409 | public function getName() |
|
1094 | |||
1095 | /** |
||
1096 | * Returns the database this Document is mapped to. |
||
1097 | * |
||
1098 | * @return string $db The database name. |
||
1099 | */ |
||
1100 | 1330 | public function getDatabase() |
|
1104 | |||
1105 | /** |
||
1106 | * Set the database this Document is mapped to. |
||
1107 | * |
||
1108 | * @param string $db The database name |
||
1109 | */ |
||
1110 | 111 | public function setDatabase($db) |
|
1114 | |||
1115 | /** |
||
1116 | * Get the collection this Document is mapped to. |
||
1117 | * |
||
1118 | * @return string $collection The collection name. |
||
1119 | */ |
||
1120 | 1322 | public function getCollection() |
|
1124 | |||
1125 | /** |
||
1126 | * Sets the collection this Document is mapped to. |
||
1127 | * |
||
1128 | * @param array|string $name |
||
1129 | * |
||
1130 | * @throws \InvalidArgumentException |
||
1131 | */ |
||
1132 | 1520 | public function setCollection($name) |
|
1146 | |||
1147 | 18 | public function getBucketName(): ?string |
|
1151 | |||
1152 | 78 | public function setBucketName(string $bucketName): void |
|
1157 | |||
1158 | 9 | public function getChunkSizeBytes(): ?int |
|
1162 | |||
1163 | 78 | public function setChunkSizeBytes(int $chunkSizeBytes): void |
|
1167 | |||
1168 | /** |
||
1169 | * Get whether or not the documents collection is capped. |
||
1170 | * |
||
1171 | * @return bool |
||
1172 | */ |
||
1173 | 5 | public function getCollectionCapped() |
|
1177 | |||
1178 | /** |
||
1179 | * Set whether or not the documents collection is capped. |
||
1180 | * |
||
1181 | * @param bool $bool |
||
1182 | */ |
||
1183 | 1 | public function setCollectionCapped($bool) |
|
1187 | |||
1188 | /** |
||
1189 | * Get the collection size |
||
1190 | * |
||
1191 | * @return int |
||
1192 | */ |
||
1193 | 5 | public function getCollectionSize() |
|
1197 | |||
1198 | /** |
||
1199 | * Set the collection size. |
||
1200 | * |
||
1201 | * @param int $size |
||
1202 | */ |
||
1203 | 1 | public function setCollectionSize($size) |
|
1207 | |||
1208 | /** |
||
1209 | * Get the collection max. |
||
1210 | * |
||
1211 | * @return int |
||
1212 | */ |
||
1213 | 5 | public function getCollectionMax() |
|
1217 | |||
1218 | /** |
||
1219 | * Set the collection max. |
||
1220 | * |
||
1221 | * @param int $max |
||
1222 | */ |
||
1223 | 1 | public function setCollectionMax($max) |
|
1227 | |||
1228 | /** |
||
1229 | * Returns TRUE if this Document is mapped to a collection FALSE otherwise. |
||
1230 | * |
||
1231 | * @return bool |
||
1232 | */ |
||
1233 | public function isMappedToCollection() |
||
1237 | |||
1238 | /** |
||
1239 | * Validates the storage strategy of a mapping for consistency |
||
1240 | * @param array $mapping |
||
1241 | * @throws MappingException |
||
1242 | */ |
||
1243 | 1427 | private function applyStorageStrategy(array &$mapping) |
|
1286 | |||
1287 | /** |
||
1288 | * Map a single embedded document. |
||
1289 | * |
||
1290 | * @param array $mapping The mapping information. |
||
1291 | */ |
||
1292 | 6 | public function mapOneEmbedded(array $mapping) |
|
1298 | |||
1299 | /** |
||
1300 | * Map a collection of embedded documents. |
||
1301 | * |
||
1302 | * @param array $mapping The mapping information. |
||
1303 | */ |
||
1304 | 5 | public function mapManyEmbedded(array $mapping) |
|
1310 | |||
1311 | /** |
||
1312 | * Map a single document reference. |
||
1313 | * |
||
1314 | * @param array $mapping The mapping information. |
||
1315 | */ |
||
1316 | 2 | public function mapOneReference(array $mapping) |
|
1322 | |||
1323 | /** |
||
1324 | * Map a collection of document references. |
||
1325 | * |
||
1326 | * @param array $mapping The mapping information. |
||
1327 | */ |
||
1328 | 1 | public function mapManyReference(array $mapping) |
|
1334 | |||
1335 | /** |
||
1336 | * INTERNAL: |
||
1337 | * Adds a field mapping without completing/validating it. |
||
1338 | * This is mainly used to add inherited field mappings to derived classes. |
||
1339 | * |
||
1340 | * @param array $fieldMapping |
||
1341 | */ |
||
1342 | 136 | public function addInheritedFieldMapping(array $fieldMapping) |
|
1352 | |||
1353 | /** |
||
1354 | * INTERNAL: |
||
1355 | * Adds an association mapping without completing/validating it. |
||
1356 | * This is mainly used to add inherited association mappings to derived classes. |
||
1357 | * |
||
1358 | * @param array $mapping |
||
1359 | * |
||
1360 | * |
||
1361 | * @throws MappingException |
||
1362 | */ |
||
1363 | 88 | public function addInheritedAssociationMapping(array $mapping/*, $owningClassName = null*/) |
|
1367 | |||
1368 | /** |
||
1369 | * Checks whether the class has a mapped association with the given field name. |
||
1370 | * |
||
1371 | * @param string $fieldName |
||
1372 | * @return bool |
||
1373 | */ |
||
1374 | 32 | public function hasReference($fieldName) |
|
1378 | |||
1379 | /** |
||
1380 | * Checks whether the class has a mapped embed with the given field name. |
||
1381 | * |
||
1382 | * @param string $fieldName |
||
1383 | * @return bool |
||
1384 | */ |
||
1385 | 5 | public function hasEmbed($fieldName) |
|
1389 | |||
1390 | /** |
||
1391 | * {@inheritDoc} |
||
1392 | * |
||
1393 | * Checks whether the class has a mapped association (embed or reference) with the given field name. |
||
1394 | */ |
||
1395 | 7 | public function hasAssociation($fieldName) |
|
1399 | |||
1400 | /** |
||
1401 | * {@inheritDoc} |
||
1402 | * |
||
1403 | * Checks whether the class has a mapped reference or embed for the specified field and |
||
1404 | * is a single valued association. |
||
1405 | */ |
||
1406 | public function isSingleValuedAssociation($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 collection valued association. |
||
1416 | */ |
||
1417 | public function isCollectionValuedAssociation($fieldName) |
||
1421 | |||
1422 | /** |
||
1423 | * Checks whether the class has a mapped association for the specified field |
||
1424 | * and if yes, checks whether it is a single-valued association (to-one). |
||
1425 | * |
||
1426 | * @param string $fieldName |
||
1427 | * @return bool TRUE if the association exists and is single-valued, FALSE otherwise. |
||
1428 | */ |
||
1429 | public function isSingleValuedReference($fieldName) |
||
1434 | |||
1435 | /** |
||
1436 | * Checks whether the class has a mapped association for the specified field |
||
1437 | * and if yes, checks whether it is a collection-valued association (to-many). |
||
1438 | * |
||
1439 | * @param string $fieldName |
||
1440 | * @return bool TRUE if the association exists and is collection-valued, FALSE otherwise. |
||
1441 | */ |
||
1442 | public function isCollectionValuedReference($fieldName) |
||
1447 | |||
1448 | /** |
||
1449 | * Checks whether the class has a mapped embedded document for the specified field |
||
1450 | * and if yes, checks whether it is a single-valued association (to-one). |
||
1451 | * |
||
1452 | * @param string $fieldName |
||
1453 | * @return bool TRUE if the association exists and is single-valued, FALSE otherwise. |
||
1454 | */ |
||
1455 | public function isSingleValuedEmbed($fieldName) |
||
1460 | |||
1461 | /** |
||
1462 | * Checks whether the class has a mapped embedded document for the specified field |
||
1463 | * and if yes, checks whether it is a collection-valued association (to-many). |
||
1464 | * |
||
1465 | * @param string $fieldName |
||
1466 | * @return bool TRUE if the association exists and is collection-valued, FALSE otherwise. |
||
1467 | */ |
||
1468 | public function isCollectionValuedEmbed($fieldName) |
||
1473 | |||
1474 | /** |
||
1475 | * Sets the ID generator used to generate IDs for instances of this class. |
||
1476 | * |
||
1477 | * @param AbstractIdGenerator $generator |
||
1478 | */ |
||
1479 | 1345 | public function setIdGenerator($generator) |
|
1483 | |||
1484 | /** |
||
1485 | * Casts the identifier to its portable PHP type. |
||
1486 | * |
||
1487 | * @param mixed $id |
||
1488 | * @return mixed $id |
||
1489 | */ |
||
1490 | 607 | public function getPHPIdentifierValue($id) |
|
1495 | |||
1496 | /** |
||
1497 | * Casts the identifier to its database type. |
||
1498 | * |
||
1499 | * @param mixed $id |
||
1500 | * @return mixed $id |
||
1501 | */ |
||
1502 | 670 | public function getDatabaseIdentifierValue($id) |
|
1507 | |||
1508 | /** |
||
1509 | * Sets the document identifier of a document. |
||
1510 | * |
||
1511 | * The value will be converted to a PHP type before being set. |
||
1512 | * |
||
1513 | * @param object $document |
||
1514 | * @param mixed $id |
||
1515 | */ |
||
1516 | 527 | public function setIdentifierValue($document, $id) |
|
1521 | |||
1522 | /** |
||
1523 | * Gets the document identifier as a PHP type. |
||
1524 | * |
||
1525 | * @param object $document |
||
1526 | * @return mixed $id |
||
1527 | */ |
||
1528 | 610 | public function getIdentifierValue($document) |
|
1532 | |||
1533 | /** |
||
1534 | * {@inheritDoc} |
||
1535 | * |
||
1536 | * Since MongoDB only allows exactly one identifier field this is a proxy |
||
1537 | * to {@see getIdentifierValue()} and returns an array with the identifier |
||
1538 | * field as a key. |
||
1539 | */ |
||
1540 | public function getIdentifierValues($object) |
||
1544 | |||
1545 | /** |
||
1546 | * Get the document identifier object as a database type. |
||
1547 | * |
||
1548 | * @param object $document |
||
1549 | * |
||
1550 | * @return ObjectId $id The ObjectId |
||
1551 | */ |
||
1552 | 31 | public function getIdentifierObject($document) |
|
1556 | |||
1557 | /** |
||
1558 | * Sets the specified field to the specified value on the given document. |
||
1559 | * |
||
1560 | * @param object $document |
||
1561 | * @param string $field |
||
1562 | * @param mixed $value |
||
1563 | */ |
||
1564 | 8 | public function setFieldValue($document, $field, $value) |
|
1574 | |||
1575 | /** |
||
1576 | * Gets the specified field's value off the given document. |
||
1577 | * |
||
1578 | * @param object $document |
||
1579 | * @param string $field |
||
1580 | * |
||
1581 | * @return mixed |
||
1582 | */ |
||
1583 | 27 | public function getFieldValue($document, $field) |
|
1591 | |||
1592 | /** |
||
1593 | * Gets the mapping of a field. |
||
1594 | * |
||
1595 | * @param string $fieldName The field name. |
||
1596 | * |
||
1597 | * @return array The field mapping. |
||
1598 | * |
||
1599 | * @throws MappingException If the $fieldName is not found in the fieldMappings array. |
||
1600 | */ |
||
1601 | 171 | public function getFieldMapping($fieldName) |
|
1608 | |||
1609 | /** |
||
1610 | * Gets mappings of fields holding embedded document(s). |
||
1611 | * |
||
1612 | * @return array of field mappings |
||
1613 | */ |
||
1614 | 565 | public function getEmbeddedFieldsMappings() |
|
1623 | |||
1624 | /** |
||
1625 | * Gets the field mapping by its DB name. |
||
1626 | * E.g. it returns identifier's mapping when called with _id. |
||
1627 | * |
||
1628 | * @param string $dbFieldName |
||
1629 | * |
||
1630 | * @return array |
||
1631 | * @throws MappingException |
||
1632 | */ |
||
1633 | 7 | public function getFieldMappingByDbFieldName($dbFieldName) |
|
1643 | |||
1644 | /** |
||
1645 | * Check if the field is not null. |
||
1646 | * |
||
1647 | * @param string $fieldName The field name |
||
1648 | * |
||
1649 | * @return bool TRUE if the field is not null, FALSE otherwise. |
||
1650 | */ |
||
1651 | 1 | public function isNullable($fieldName) |
|
1659 | |||
1660 | /** |
||
1661 | * Checks whether the document has a discriminator field and value configured. |
||
1662 | * |
||
1663 | * @return bool |
||
1664 | */ |
||
1665 | 507 | public function hasDiscriminator() |
|
1669 | |||
1670 | /** |
||
1671 | * Sets the type of Id generator to use for the mapped class. |
||
1672 | * |
||
1673 | * @param string $generatorType Generator type. |
||
1674 | */ |
||
1675 | 911 | public function setIdGeneratorType($generatorType) |
|
1679 | |||
1680 | /** |
||
1681 | * Sets the Id generator options. |
||
1682 | * |
||
1683 | * @param array $generatorOptions Generator options. |
||
1684 | */ |
||
1685 | public function setIdGeneratorOptions($generatorOptions) |
||
1689 | |||
1690 | /** |
||
1691 | * @return bool |
||
1692 | */ |
||
1693 | 574 | public function isInheritanceTypeNone() |
|
1697 | |||
1698 | /** |
||
1699 | * Checks whether the mapped class uses the SINGLE_COLLECTION inheritance mapping strategy. |
||
1700 | * |
||
1701 | * @return bool |
||
1702 | */ |
||
1703 | 910 | public function isInheritanceTypeSingleCollection() |
|
1707 | |||
1708 | /** |
||
1709 | * Checks whether the mapped class uses the COLLECTION_PER_CLASS inheritance mapping strategy. |
||
1710 | * |
||
1711 | * @return bool |
||
1712 | */ |
||
1713 | public function isInheritanceTypeCollectionPerClass() |
||
1717 | |||
1718 | /** |
||
1719 | * Sets the mapped subclasses of this class. |
||
1720 | * |
||
1721 | * @param string[] $subclasses The names of all mapped subclasses. |
||
1722 | */ |
||
1723 | 2 | public function setSubclasses(array $subclasses) |
|
1729 | |||
1730 | /** |
||
1731 | * Sets the parent class names. |
||
1732 | * Assumes that the class names in the passed array are in the order: |
||
1733 | * directParent -> directParentParent -> directParentParentParent ... -> root. |
||
1734 | * |
||
1735 | * @param string[] $classNames |
||
1736 | */ |
||
1737 | 1400 | public function setParentClasses(array $classNames) |
|
1747 | |||
1748 | /** |
||
1749 | * Checks whether the class will generate a new \MongoDB\BSON\ObjectId instance for us. |
||
1750 | * |
||
1751 | * @return bool TRUE if the class uses the AUTO generator, FALSE otherwise. |
||
1752 | */ |
||
1753 | public function isIdGeneratorAuto() |
||
1757 | |||
1758 | /** |
||
1759 | * Checks whether the class will use a collection to generate incremented identifiers. |
||
1760 | * |
||
1761 | * @return bool TRUE if the class uses the INCREMENT generator, FALSE otherwise. |
||
1762 | */ |
||
1763 | public function isIdGeneratorIncrement() |
||
1767 | |||
1768 | /** |
||
1769 | * Checks whether the class will generate a uuid id. |
||
1770 | * |
||
1771 | * @return bool TRUE if the class uses the UUID generator, FALSE otherwise. |
||
1772 | */ |
||
1773 | public function isIdGeneratorUuid() |
||
1777 | |||
1778 | /** |
||
1779 | * Checks whether the class uses no id generator. |
||
1780 | * |
||
1781 | * @return bool TRUE if the class does not use any id generator, FALSE otherwise. |
||
1782 | */ |
||
1783 | public function isIdGeneratorNone() |
||
1787 | |||
1788 | /** |
||
1789 | * Sets the version field mapping used for versioning. Sets the default |
||
1790 | * value to use depending on the column type. |
||
1791 | * |
||
1792 | * @param array $mapping The version field mapping array |
||
1793 | * |
||
1794 | * @throws LockException |
||
1795 | */ |
||
1796 | 87 | public function setVersionMapping(array &$mapping) |
|
1805 | |||
1806 | /** |
||
1807 | * Sets whether this class is to be versioned for optimistic locking. |
||
1808 | * |
||
1809 | * @param bool $bool |
||
1810 | */ |
||
1811 | 911 | public function setVersioned($bool) |
|
1815 | |||
1816 | /** |
||
1817 | * Sets the name of the field that is to be used for versioning if this class is |
||
1818 | * versioned for optimistic locking. |
||
1819 | * |
||
1820 | * @param string $versionField |
||
1821 | */ |
||
1822 | 911 | public function setVersionField($versionField) |
|
1826 | |||
1827 | /** |
||
1828 | * Sets the version field mapping used for versioning. Sets the default |
||
1829 | * value to use depending on the column type. |
||
1830 | * |
||
1831 | * @param array $mapping The version field mapping array |
||
1832 | * |
||
1833 | * @throws LockException |
||
1834 | */ |
||
1835 | 22 | public function setLockMapping(array &$mapping) |
|
1844 | |||
1845 | /** |
||
1846 | * Sets whether this class is to allow pessimistic locking. |
||
1847 | * |
||
1848 | * @param bool $bool |
||
1849 | */ |
||
1850 | public function setLockable($bool) |
||
1854 | |||
1855 | /** |
||
1856 | * Sets the name of the field that is to be used for storing whether a document |
||
1857 | * is currently locked or not. |
||
1858 | * |
||
1859 | * @param string $lockField |
||
1860 | */ |
||
1861 | public function setLockField($lockField) |
||
1865 | |||
1866 | /** |
||
1867 | * Marks this class as read only, no change tracking is applied to it. |
||
1868 | */ |
||
1869 | 5 | public function markReadOnly() |
|
1873 | |||
1874 | /** |
||
1875 | * {@inheritDoc} |
||
1876 | */ |
||
1877 | public function getFieldNames() |
||
1881 | |||
1882 | /** |
||
1883 | * {@inheritDoc} |
||
1884 | */ |
||
1885 | public function getAssociationNames() |
||
1889 | |||
1890 | /** |
||
1891 | * {@inheritDoc} |
||
1892 | */ |
||
1893 | 23 | public function getTypeOfField($fieldName) |
|
1898 | |||
1899 | /** |
||
1900 | * {@inheritDoc} |
||
1901 | */ |
||
1902 | 4 | public function getAssociationTargetClass($assocName) |
|
1910 | |||
1911 | /** |
||
1912 | * Retrieve the collectionClass associated with an association |
||
1913 | * |
||
1914 | * @param string $assocName |
||
1915 | */ |
||
1916 | 1 | public function getAssociationCollectionClass($assocName) |
|
1928 | |||
1929 | /** |
||
1930 | * {@inheritDoc} |
||
1931 | */ |
||
1932 | public function isAssociationInverseSide($fieldName) |
||
1936 | |||
1937 | /** |
||
1938 | * {@inheritDoc} |
||
1939 | */ |
||
1940 | public function getAssociationMappedByTargetField($fieldName) |
||
1944 | |||
1945 | /** |
||
1946 | * Map a field. |
||
1947 | * |
||
1948 | * @param array $mapping The mapping information. |
||
1949 | * |
||
1950 | * @return array |
||
1951 | * |
||
1952 | * @throws MappingException |
||
1953 | */ |
||
1954 | 1443 | public function mapField(array $mapping) |
|
2115 | |||
2116 | /** |
||
2117 | * Determines which fields get serialized. |
||
2118 | * |
||
2119 | * It is only serialized what is necessary for best unserialization performance. |
||
2120 | * That means any metadata properties that are not set or empty or simply have |
||
2121 | * their default value are NOT serialized. |
||
2122 | * |
||
2123 | * Parts that are also NOT serialized because they can not be properly unserialized: |
||
2124 | * - reflClass (ReflectionClass) |
||
2125 | * - reflFields (ReflectionProperty array) |
||
2126 | * |
||
2127 | * @return array The names of all the fields that should be serialized. |
||
2128 | */ |
||
2129 | 6 | public function __sleep() |
|
2208 | |||
2209 | /** |
||
2210 | * Restores some state that can not be serialized/unserialized. |
||
2211 | * |
||
2212 | */ |
||
2213 | 6 | public function __wakeup() |
|
2229 | |||
2230 | /** |
||
2231 | * Creates a new instance of the mapped class, without invoking the constructor. |
||
2232 | * |
||
2233 | * @return object |
||
2234 | */ |
||
2235 | 360 | public function newInstance() |
|
2239 | |||
2240 | 80 | private function isAllowedGridFSField(string $name): bool |
|
2244 | } |
||
2245 |
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..