Skip to content

Commit d99f74c

Browse files
committed
Deprecate ClassMetadata::$reflFields
It is replaced with property accessors since #11659
1 parent 62ca842 commit d99f74c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

UPGRADE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ that implements `ArrayAccess`.
6969
Use the new `Doctrine\ORM\Mapping\PropertyAccessors\PropertyAccessor` API and access
7070
through `Doctrine\ORM\Mapping\ClassMetadata::$propertyAccessors` instead.
7171

72+
Companion accessor methods are deprecated as well.
73+
7274
# Upgrade to 3.3
7375

7476
## Deprecate `DatabaseDriver`

src/Mapping/ClassMetadata.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ class ClassMetadata implements PersistenceClassMetadata, Stringable
544544
/**
545545
* The ReflectionProperty instances of the mapped class.
546546
*
547+
* @deprecated Use $propertyAccessors instead.
548+
*
547549
* @var LegacyReflectionFields|array<string, ReflectionProperty>
548550
*/
549551
public LegacyReflectionFields|array $reflFields = [];
@@ -573,6 +575,8 @@ public function __construct(public string $name, NamingStrategy|null $namingStra
573575
/**
574576
* Gets the ReflectionProperties of the mapped class.
575577
*
578+
* @deprecated Use getPropertyAccessors() instead.
579+
*
576580
* @return LegacyReflectionFields|ReflectionProperty[] An array of ReflectionProperty instances.
577581
* @phpstan-return LegacyReflectionFields|array<string, ReflectionProperty>
578582
*/
@@ -593,6 +597,8 @@ public function getPropertyAccessors(): array
593597

594598
/**
595599
* Gets a ReflectionProperty for a specific field of the mapped class.
600+
*
601+
* @deprecated Use getPropertyAccessor() instead.
596602
*/
597603
public function getReflectionProperty(string $name): ReflectionProperty|null
598604
{
@@ -604,7 +610,11 @@ public function getPropertyAccessor(string $name): PropertyAccessor|null
604610
return $this->propertyAccessors[$name] ?? null;
605611
}
606612

607-
/** @throws BadMethodCallException If the class has a composite identifier. */
613+
/**
614+
* @deprecated Use getPropertyAccessor() instead.
615+
*
616+
* @throws BadMethodCallException If the class has a composite identifier.
617+
*/
608618
public function getSingleIdReflectionProperty(): ReflectionProperty|null
609619
{
610620
if ($this->isIdentifierComposite) {
@@ -818,7 +828,8 @@ public function newInstance(): object
818828
public function wakeupReflection(ReflectionService $reflService): void
819829
{
820830
// Restore ReflectionClass and properties
821-
$this->reflClass = $reflService->getClass($this->name);
831+
$this->reflClass = $reflService->getClass($this->name);
832+
/** @phpstan-ignore property.deprecated */
822833
$this->reflFields = new LegacyReflectionFields($this, $reflService);
823834
$this->instantiator = $this->instantiator ?: new Instantiator();
824835

0 commit comments

Comments
 (0)