Skip to content

Commit ba0ea89

Browse files
greg0irederrabusSteve Todd
authored
Use class from persistence package (#11330)
* Use class from persistence package It is meant to remove duplication between the ORM and the ODM. * Update UPGRADE.md Co-authored-by: Steve Todd <[email protected]> --------- Co-authored-by: Alexander M. Turek <[email protected]> Co-authored-by: Steve Todd <[email protected]>
1 parent 53763d4 commit ba0ea89

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

UPGRADE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Upgrade to 3.1
22

3+
## Deprecate `Doctrine\ORM\Mapping\ReflectionEnumProperty`
4+
5+
This class is deprecated and will be removed in 4.0.
6+
Instead, use `Doctrine\Persistence\Reflection\EnumReflectionProperty` from
7+
`doctrine/persistence`.
8+
39
## Deprecate passing null to `ClassMetadata::fullyQualifiedClassName()`
410

511
Passing `null` to `Doctrine\ORM\ClassMetadata::fullyQualifiedClassName()` is

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"doctrine/inflector": "^1.4 || ^2.0",
3131
"doctrine/instantiator": "^1.3 || ^2",
3232
"doctrine/lexer": "^3",
33-
"doctrine/persistence": "^3.1.1",
33+
"doctrine/persistence": "^3.3.1",
3434
"psr/cache": "^1 || ^2 || ^3",
3535
"symfony/console": "^5.4 || ^6.0 || ^7.0",
3636
"symfony/var-exporter": "~6.2.13 || ^6.3.2 || ^7.0"

src/Mapping/ClassMetadata.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\ORM\Id\AbstractIdGenerator;
1616
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
1717
use Doctrine\Persistence\Mapping\ReflectionService;
18+
use Doctrine\Persistence\Reflection\EnumReflectionProperty;
1819
use InvalidArgumentException;
1920
use LogicException;
2021
use ReflectionClass;
@@ -822,7 +823,7 @@ public function wakeupReflection(ReflectionService $reflService): void
822823
assert($childProperty !== null);
823824

824825
if (isset($mapping->enumType)) {
825-
$childProperty = new ReflectionEnumProperty(
826+
$childProperty = new EnumReflectionProperty(
826827
$childProperty,
827828
$mapping->enumType,
828829
);
@@ -841,7 +842,7 @@ public function wakeupReflection(ReflectionService $reflService): void
841842
: $this->getAccessibleProperty($reflService, $this->name, $field);
842843

843844
if (isset($mapping->enumType) && $this->reflFields[$field] !== null) {
844-
$this->reflFields[$field] = new ReflectionEnumProperty(
845+
$this->reflFields[$field] = new EnumReflectionProperty(
845846
$this->reflFields[$field],
846847
$mapping->enumType,
847848
);

src/Mapping/ReflectionEmbeddedProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
private readonly ReflectionProperty $childProperty,
3131
private readonly string $embeddedClass,
3232
) {
33-
parent::__construct($childProperty->class, $childProperty->name);
33+
parent::__construct($childProperty->getDeclaringClass()->name, $childProperty->getName());
3434
}
3535

3636
public function getValue(object|null $object = null): mixed

src/Mapping/ReflectionEnumProperty.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use function array_map;
1212
use function is_array;
1313

14+
/** @deprecated use Doctrine\Persistence\Reflection\EnumReflectionProperty instead */
1415
final class ReflectionEnumProperty extends ReflectionProperty
1516
{
1617
/** @param class-string<BackedEnum> $enumType */

0 commit comments

Comments
 (0)