diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index b3167948cb8..9d8f27cd1a8 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1176,7 +1176,7 @@ public function initializeReflection($reflService) $this->namespace = $reflService->getClassNamespace($this->name); if ($this->reflClass) { - $this->name = $this->rootEntityName = $this->reflClass->getName(); + $this->name = $this->rootEntityName = $this->reflClass->name; } $this->table['name'] = $this->namingStrategy->classToTableName($this->name); @@ -3866,7 +3866,7 @@ private function getAccessibleProperty(ReflectionService $reflService, string $c { $reflectionProperty = $reflService->getAccessibleProperty($class, $field); if ($reflectionProperty !== null && PHP_VERSION_ID >= 80100 && $reflectionProperty->isReadOnly()) { - $declaringClass = $reflectionProperty->getDeclaringClass()->name; + $declaringClass = $reflectionProperty->class; if ($declaringClass !== $class) { $reflectionProperty = $reflService->getAccessibleProperty($declaringClass, $field); } diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index 8fdb4495b0f..24ffa0d4168 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -365,7 +365,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad } $mapping = []; - $mapping['fieldName'] = $property->getName(); + $mapping['fieldName'] = $property->name; // Evaluate @Cache annotation $cacheAnnot = $this->reader->getPropertyAnnotation($property, Mapping\Cache::class); @@ -398,7 +398,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad // @Column, @OneToOne, @OneToMany, @ManyToOne, @ManyToMany $columnAnnot = $this->reader->getPropertyAnnotation($property, Mapping\Column::class); if ($columnAnnot) { - $mapping = $this->columnToArray($property->getName(), $columnAnnot); + $mapping = $this->columnToArray($property->name, $columnAnnot); $idAnnot = $this->reader->getPropertyAnnotation($property, Mapping\Id::class); if ($idAnnot) { diff --git a/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php index 4ad46928dfd..1e14836833e 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php @@ -315,7 +315,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad } $mapping = []; - $mapping['fieldName'] = $property->getName(); + $mapping['fieldName'] = $property->name; // Evaluate #[Cache] attribute $cacheAttribute = $this->reader->getPropertyAttribute($property, Mapping\Cache::class); @@ -350,7 +350,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad $embeddedAttribute = $this->reader->getPropertyAttribute($property, Mapping\Embedded::class); if ($columnAttribute !== null) { - $mapping = $this->columnToArray($property->getName(), $columnAttribute); + $mapping = $this->columnToArray($property->name, $columnAttribute); if ($this->reader->getPropertyAttribute($property, Mapping\Id::class)) { $mapping['id'] = true; diff --git a/lib/Doctrine/ORM/Mapping/Driver/ReflectionBasedDriver.php b/lib/Doctrine/ORM/Mapping/Driver/ReflectionBasedDriver.php index e42aab7b9cc..a2900d13e01 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/ReflectionBasedDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/ReflectionBasedDriver.php @@ -32,7 +32,7 @@ private function isRepeatedPropertyDeclaration(ReflectionProperty $property, Cla || $metadata->isInheritedEmbeddedClass($property->name); } - $declaringClass = $property->getDeclaringClass()->getName(); + $declaringClass = $property->class; if ( isset($metadata->fieldMappings[$property->name]['declared']) diff --git a/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php b/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php index 11b41ea9332..b6a289d5e79 100644 --- a/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php +++ b/lib/Doctrine/ORM/Mapping/Reflection/ReflectionPropertiesGetter.php @@ -73,7 +73,7 @@ private function getHierarchyClasses(string $className): array $parentClass = $currentClass->getParentClass(); if ($parentClass) { - $parentClassName = $parentClass->getName(); + $parentClassName = $parentClass->name; } } @@ -111,14 +111,14 @@ private function isInstanceProperty(ReflectionProperty $reflectionProperty): boo private function getAccessibleProperty(ReflectionProperty $property): ?ReflectionProperty { return $this->reflectionService->getAccessibleProperty( - $property->getDeclaringClass()->getName(), - $property->getName() + $property->class, + $property->name ); } private function getLogicalName(ReflectionProperty $property): string { - $propertyName = $property->getName(); + $propertyName = $property->name; if ($property->isPublic()) { return $propertyName; @@ -128,6 +128,6 @@ private function getLogicalName(ReflectionProperty $property): string return "\0*\0" . $propertyName; } - return "\0" . $property->getDeclaringClass()->getName() . "\0" . $propertyName; + return "\0" . $property->class . "\0" . $propertyName; } } diff --git a/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php b/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php index 563a699480f..db4c1f868a3 100644 --- a/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php +++ b/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php @@ -38,7 +38,7 @@ public function __construct(ReflectionProperty $parentProperty, ReflectionProper $this->childProperty = $childProperty; $this->embeddedClass = (string) $embeddedClass; - parent::__construct($childProperty->getDeclaringClass()->getName(), $childProperty->getName()); + parent::__construct($childProperty->class, $childProperty->name); } /** diff --git a/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php b/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php index a162ebfd345..3283a54ab0d 100644 --- a/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php +++ b/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php @@ -28,8 +28,8 @@ public function __construct(ReflectionProperty $originalReflectionProperty, stri $this->enumType = $enumType; parent::__construct( - $originalReflectionProperty->getDeclaringClass()->getName(), - $originalReflectionProperty->getName() + $originalReflectionProperty->class, + $originalReflectionProperty->name ); } @@ -98,7 +98,7 @@ private function initializeEnumValue($object, $value): BackedEnum } catch (ValueError $e) { throw MappingException::invalidEnumValue( get_class($object), - $this->originalReflectionProperty->getName(), + $this->originalReflectionProperty->name, (string) $value, $enumType, $e diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php index 77a49061538..63c925861c4 100644 --- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -335,13 +335,13 @@ private function generateSkippedProperties(ClassMetadata $class): string while ($reflector) { foreach ($reflector->getProperties($filter) as $property) { - $name = $property->getName(); + $name = $property->name; if ($property->isStatic() || (($class->hasField($name) || $class->hasAssociation($name)) && ! isset($identifiers[$name]))) { continue; } - $prefix = $property->isPrivate() ? "\0" . $property->getDeclaringClass()->getName() . "\0" : ($property->isProtected() ? "\0*\0" : ''); + $prefix = $property->isPrivate() ? "\0" . $property->class . "\0" : ($property->isProtected() ? "\0*\0" : ''); $skippedProperties[$prefix . $name] = true; } @@ -376,7 +376,7 @@ private function generateSerializeImpl(ClassMetadata $class): string return $code . '$data = []; foreach (parent::__sleep() as $name) { - $value = $properties[$k = $name] ?? $properties[$k = "\0*\0$name"] ?? $properties[$k = "\0' . $reflector->getName() . '\0$name"] ?? $k = null; + $value = $properties[$k = $name] ?? $properties[$k = "\0*\0$name"] ?? $properties[$k = "\0' . $reflector->name . '\0$name"] ?? $k = null; if (null === $k) { trigger_error(sprintf(\'serialize(): "%s" returned as member variable from __sleep() but does not exist\', $name), \E_USER_NOTICE); diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 34f4eba6258..5bf086d52b5 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -969,7 +969,7 @@ protected function getClassToExtendName() { $refl = new ReflectionClass($this->getClassToExtend()); - return '\\' . $refl->getName(); + return '\\' . $refl->name; } /** @return string */