2323use Doctrine \ODM \MongoDB \Types \Versionable ;
2424use Doctrine \ODM \MongoDB \Utility \CollectionHelper ;
2525use Doctrine \Persistence \Mapping \ClassMetadata as BaseClassMetadata ;
26- use Doctrine \Persistence \Mapping \ReflectionService ;
27- use Doctrine \Persistence \Mapping \RuntimeReflectionService ;
2826use InvalidArgumentException ;
2927use LogicException ;
3028use MongoDB \BSON \Decimal128 ;
3331use ReflectionClass ;
3432use ReflectionEnum ;
3533use ReflectionNamedType ;
36- use ReflectionProperty ;
3734use Symfony \Component \Uid \UuidV1 ;
3835use Symfony \Component \Uid \UuidV4 ;
3936use Symfony \Component \Uid \UuidV7 ;
@@ -436,15 +433,6 @@ final class ClassMetadata implements BaseClassMetadata
436433 */
437434 public const CHANGETRACKING_DEFERRED_EXPLICIT = 2 ;
438435
439- /**
440- * NOTIFY means that Doctrine relies on the entities sending out notifications
441- * when their properties change. Such entity classes must implement
442- * the <tt>NotifyPropertyChanged</tt> interface.
443- *
444- * @deprecated
445- */
446- public const CHANGETRACKING_NOTIFY = 3 ;
447-
448436 /**
449437 * SET means that fields will be written to the database using a $set operator
450438 */
@@ -609,15 +597,6 @@ final class ClassMetadata implements BaseClassMetadata
609597 */
610598 public private(set) array $ subClasses = [];
611599
612- /**
613- * The ReflectionProperty instances of the mapped class.
614- *
615- * @deprecated Since 2.13, use $propertyAccessors instead.
616- *
617- * @var LegacyReflectionFields|array<ReflectionProperty>
618- */
619- public private(set) LegacyReflectionFields |array $ reflFields = [];
620-
621600 /** @var array<string, PropertyAccessors\PropertyAccessor> */
622601 public private(set) array $ propertyAccessors = [];
623602
@@ -802,8 +781,6 @@ final class ClassMetadata implements BaseClassMetadata
802781
803782 private InstantiatorInterface $ instantiator ;
804783
805- private ReflectionService $ reflectionService ;
806-
807784 /** @var class-string|null */
808785 private ?string $ rootClass ;
809786
@@ -817,9 +794,7 @@ public function __construct(string $documentName)
817794 {
818795 $ this ->name = $ documentName ;
819796 $ this ->rootDocumentName = $ documentName ;
820- $ this ->reflectionService = new RuntimeReflectionService ();
821797 $ this ->reflClass = new ReflectionClass ($ documentName );
822- $ this ->reflFields = new LegacyReflectionFields ($ this , $ this ->reflectionService );
823798 $ this ->setCollection ($ this ->reflClass ->getShortName ());
824799 $ this ->instantiator = new Instantiator ();
825800 }
@@ -1424,29 +1399,6 @@ public function isChangeTrackingDeferredImplicit(): bool
14241399 return $ this ->changeTrackingPolicy === self ::CHANGETRACKING_DEFERRED_IMPLICIT ;
14251400 }
14261401
1427- /**
1428- * Whether the change tracking policy of this class is "notify".
1429- *
1430- * @deprecated This method was deprecated in doctrine/mongodb-odm 2.4. Please use DEFERRED_EXPLICIT tracking
1431- * policy and isChangeTrackingDeferredImplicit method to detect it.
1432- */
1433- public function isChangeTrackingNotify (): bool
1434- {
1435- return $ this ->changeTrackingPolicy === self ::CHANGETRACKING_NOTIFY ;
1436- }
1437-
1438- /**
1439- * Gets the ReflectionProperties of the mapped class.
1440- *
1441- * @deprecated Since 2.13, use getPropertyAccessors() instead.
1442- *
1443- * @return array<ReflectionProperty>|LegacyReflectionFields
1444- */
1445- public function getReflectionProperties (): array |LegacyReflectionFields
1446- {
1447- return $ this ->reflFields ;
1448- }
1449-
14501402 /**
14511403 * Gets the ReflectionProperties of the mapped class.
14521404 *
@@ -1457,16 +1409,6 @@ public function getPropertyAccessors(): array
14571409 return $ this ->propertyAccessors ;
14581410 }
14591411
1460- /**
1461- * Gets a ReflectionProperty for a specific field of the mapped class.
1462- *
1463- * @deprecated Since 2.13, use getPropertyAccessor() instead.
1464- */
1465- public function getReflectionProperty (string $ name ): ReflectionProperty
1466- {
1467- return $ this ->reflFields [$ name ];
1468- }
1469-
14701412 public function getPropertyAccessor (string $ name ): PropertyAccessor |null
14711413 {
14721414 return $ this ->propertyAccessors [$ name ] ?? null ;
@@ -2407,13 +2349,7 @@ public function mapField(array $mapping): array
24072349 }
24082350
24092351 if (isset ($ mapping ['targetDocument ' ]) && isset ($ mapping ['discriminatorMap ' ])) {
2410- trigger_deprecation (
2411- 'doctrine/mongodb-odm ' ,
2412- '2.2 ' ,
2413- 'Mapping both "targetDocument" and "discriminatorMap" on field "%s" in class "%s" is deprecated. Only one of them can be used at a time ' ,
2414- $ mapping ['fieldName ' ],
2415- $ this ->name ,
2416- );
2352+ throw MappingException::targetDocumentCanNotBeCombinedWithDiscriminatorMap ($ this ->name , $ mapping ['fieldName ' ]);
24172353 }
24182354
24192355 if (isset ($ mapping ['reference ' ]) && $ mapping ['type ' ] === self ::ONE ) {
@@ -2535,7 +2471,6 @@ public function mapField(array $mapping): array
25352471 *
25362472 * Parts that are also NOT serialized because they cannot be properly unserialized:
25372473 * - reflClass (ReflectionClass)
2538- * - reflFields (ReflectionProperty array)
25392474 * - propertyAccessors (ReflectionProperty array)
25402475 *
25412476 * @return array The names of all the fields that should be serialized.
@@ -2645,8 +2580,6 @@ public function __wakeup(): void
26452580 // Restore ReflectionClass and properties
26462581 $ this ->reflClass = new ReflectionClass ($ this ->name );
26472582 $ this ->instantiator = new Instantiator ();
2648- $ this ->reflectionService = new RuntimeReflectionService ();
2649- $ this ->reflFields = new LegacyReflectionFields ($ this , $ this ->reflectionService );
26502583
26512584 foreach ($ this ->fieldMappings as $ field => $ mapping ) {
26522585 $ accessor = PropertyAccessorFactory::createPropertyAccessor ($ mapping ['declared ' ] ?? $ this ->name , $ field );
0 commit comments