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 ;
@@ -609,15 +606,6 @@ final class ClassMetadata implements BaseClassMetadata
609606 */
610607 public private(set) array $ subClasses = [];
611608
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-
621609 /** @var array<string, PropertyAccessors\PropertyAccessor> */
622610 public private(set) array $ propertyAccessors = [];
623611
@@ -802,8 +790,6 @@ final class ClassMetadata implements BaseClassMetadata
802790
803791 private InstantiatorInterface $ instantiator ;
804792
805- private ReflectionService $ reflectionService ;
806-
807793 /** @var class-string|null */
808794 private ?string $ rootClass ;
809795
@@ -817,9 +803,7 @@ public function __construct(string $documentName)
817803 {
818804 $ this ->name = $ documentName ;
819805 $ this ->rootDocumentName = $ documentName ;
820- $ this ->reflectionService = new RuntimeReflectionService ();
821806 $ this ->reflClass = new ReflectionClass ($ documentName );
822- $ this ->reflFields = new LegacyReflectionFields ($ this , $ this ->reflectionService );
823807 $ this ->setCollection ($ this ->reflClass ->getShortName ());
824808 $ this ->instantiator = new Instantiator ();
825809 }
@@ -1424,29 +1408,6 @@ public function isChangeTrackingDeferredImplicit(): bool
14241408 return $ this ->changeTrackingPolicy === self ::CHANGETRACKING_DEFERRED_IMPLICIT ;
14251409 }
14261410
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-
14501411 /**
14511412 * Gets the ReflectionProperties of the mapped class.
14521413 *
@@ -1457,16 +1418,6 @@ public function getPropertyAccessors(): array
14571418 return $ this ->propertyAccessors ;
14581419 }
14591420
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-
14701421 public function getPropertyAccessor (string $ name ): PropertyAccessor |null
14711422 {
14721423 return $ this ->propertyAccessors [$ name ] ?? null ;
@@ -2407,13 +2358,7 @@ public function mapField(array $mapping): array
24072358 }
24082359
24092360 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- );
2361+ throw MappingException::targetDocumentCanNotBeCombinedWithDiscriminatorMap ($ this ->name , $ mapping ['fieldName ' ]);
24172362 }
24182363
24192364 if (isset ($ mapping ['reference ' ]) && $ mapping ['type ' ] === self ::ONE ) {
@@ -2535,7 +2480,6 @@ public function mapField(array $mapping): array
25352480 *
25362481 * Parts that are also NOT serialized because they cannot be properly unserialized:
25372482 * - reflClass (ReflectionClass)
2538- * - reflFields (ReflectionProperty array)
25392483 * - propertyAccessors (ReflectionProperty array)
25402484 *
25412485 * @return array The names of all the fields that should be serialized.
@@ -2645,8 +2589,6 @@ public function __wakeup(): void
26452589 // Restore ReflectionClass and properties
26462590 $ this ->reflClass = new ReflectionClass ($ this ->name );
26472591 $ this ->instantiator = new Instantiator ();
2648- $ this ->reflectionService = new RuntimeReflectionService ();
2649- $ this ->reflFields = new LegacyReflectionFields ($ this , $ this ->reflectionService );
26502592
26512593 foreach ($ this ->fieldMappings as $ field => $ mapping ) {
26522594 $ accessor = PropertyAccessorFactory::createPropertyAccessor ($ mapping ['declared ' ] ?? $ this ->name , $ field );
0 commit comments