|
24 | 24 | use Doctrine\Persistence\Mapping\ClassMetadata as ClassMetadataInterface;
|
25 | 25 | use Doctrine\Persistence\Mapping\Driver\MappingDriver;
|
26 | 26 | use Doctrine\Persistence\Mapping\ReflectionService;
|
27 |
| -use LogicException; |
28 | 27 | use ReflectionClass;
|
29 | 28 | use ReflectionException;
|
30 | 29 |
|
@@ -299,14 +298,6 @@ protected function validateRuntimeMetadata(ClassMetadata $class, ClassMetadataIn
|
299 | 298 | // second condition is necessary for mapped superclasses in the middle of an inheritance hierarchy
|
300 | 299 | throw MappingException::noInheritanceOnMappedSuperClass($class->name);
|
301 | 300 | }
|
302 |
| - |
303 |
| - foreach ($class->propertyAccessors as $propertyAccessor) { |
304 |
| - $property = $propertyAccessor->getUnderlyingReflector(); |
305 |
| - |
306 |
| - if (PHP_VERSION_ID >= 80400 && count($property->getHooks()) > 0) { |
307 |
| - throw new LogicException('Doctrine ORM does not support property hooks without also enabling Configuration::enableNativeLazyObjects(true). Check https://github.com/doctrine/orm/issues/11624 for details of versions that support property hooks.'); |
308 |
| - } |
309 |
| - } |
310 | 301 | }
|
311 | 302 |
|
312 | 303 | protected function newClassMetadataInstance(string $className): ClassMetadata
|
@@ -710,6 +701,18 @@ private function inheritIdGeneratorMapping(ClassMetadata $class, ClassMetadata $
|
710 | 701 | protected function wakeupReflection(ClassMetadataInterface $class, ReflectionService $reflService): void
|
711 | 702 | {
|
712 | 703 | $class->wakeupReflection($reflService);
|
| 704 | + |
| 705 | + if (PHP_VERSION_ID < 80400) { |
| 706 | + return; |
| 707 | + } |
| 708 | + |
| 709 | + foreach ($class->propertyAccessors as $propertyAccessor) { |
| 710 | + $property = $propertyAccessor->getUnderlyingReflector(); |
| 711 | + |
| 712 | + if ($property->isVirtual()) { |
| 713 | + throw MappingException::mappingVirtualPropertyNotAllowed($class->name, $property->getName()); |
| 714 | + } |
| 715 | + } |
713 | 716 | }
|
714 | 717 |
|
715 | 718 | protected function initializeReflection(ClassMetadataInterface $class, ReflectionService $reflService): void
|
|
0 commit comments