Skip to content

Commit

Permalink
Use class from persistence package
Browse files Browse the repository at this point in the history
It is meant to remove duplication between the ORM and the ODM.
  • Loading branch information
greg0ire committed Mar 1, 2024
1 parent 53763d4 commit 5a3adc1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Upgrade to 3.1

## Deprecate `Doctrine\ORM\Mapping\ReflectionEnumProperty`

This class is deprecated and will be removed in 4.0.
Instead, use `Doctrine\Persistence\ReflectionEnumProperty` from
`doctrine/persistence`.

## Deprecate passing null to `ClassMetadata::fullyQualifiedClassName()`

Passing `null` to `Doctrine\ORM\ClassMetadata::fullyQualifiedClassName()` is
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"doctrine/inflector": "^1.4 || ^2.0",
"doctrine/instantiator": "^1.3 || ^2",
"doctrine/lexer": "^3",
"doctrine/persistence": "^3.1.1",
"doctrine/persistence": "^3.3.1",
"psr/cache": "^1 || ^2 || ^3",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/var-exporter": "~6.2.13 || ^6.3.2 || ^7.0"
Expand Down
5 changes: 3 additions & 2 deletions src/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Doctrine\ORM\Id\AbstractIdGenerator;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
use Doctrine\Persistence\Mapping\ReflectionService;
use Doctrine\Persistence\Reflection\EnumReflectionProperty;
use InvalidArgumentException;
use LogicException;
use ReflectionClass;
Expand Down Expand Up @@ -822,7 +823,7 @@ public function wakeupReflection(ReflectionService $reflService): void
assert($childProperty !== null);

if (isset($mapping->enumType)) {
$childProperty = new ReflectionEnumProperty(
$childProperty = new EnumReflectionProperty(
$childProperty,
$mapping->enumType,
);
Expand All @@ -841,7 +842,7 @@ public function wakeupReflection(ReflectionService $reflService): void
: $this->getAccessibleProperty($reflService, $this->name, $field);

if (isset($mapping->enumType) && $this->reflFields[$field] !== null) {
$this->reflFields[$field] = new ReflectionEnumProperty(
$this->reflFields[$field] = new EnumReflectionProperty(
$this->reflFields[$field],
$mapping->enumType,
);
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/ReflectionEmbeddedProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(
private readonly ReflectionProperty $childProperty,
private readonly string $embeddedClass,
) {
parent::__construct($childProperty->class, $childProperty->name);
parent::__construct($childProperty->getDeclaringClass()->name, $childProperty->getName());
}

public function getValue(object|null $object = null): mixed
Expand Down
1 change: 1 addition & 0 deletions src/Mapping/ReflectionEnumProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use function array_map;
use function is_array;

/** @deprecated use Doctrine\Persistence\Reflection\EnumReflectionProperty instead */
final class ReflectionEnumProperty extends ReflectionProperty
{
/** @param class-string<BackedEnum> $enumType */
Expand Down

0 comments on commit 5a3adc1

Please sign in to comment.