1
0
mirror of synced 2025-02-20 22:23:14 +03:00

DDC-2704 - handling partial initialization of the class as expected (class metadata may not hold reflection class after wakeup)

This commit is contained in:
Marco Pivetta 2015-01-20 15:03:22 +01:00
parent 1e6c071bb8
commit a4982a8dc2

View File

@ -3347,20 +3347,24 @@ class ClassMetadataInfo implements ClassMetadata
*/
private function initializeAllReflectionProperties(ReflectionService $reflectionService)
{
$class = $this->reflClass;
$properties = array();
if (! $this->reflClass) {
return;
}
$currentClass = $this->reflClass;
$properties = array();
do {
$className = $class->getName();
$className = $currentClass->getName();
foreach ($class->getProperties() as $property) {
foreach ($currentClass->getProperties() as $property) {
// static properties are not instance properties
if ($property->isStatic()) {
continue;
}
// indexing by logical name to avoid duplicates
$logicalName = $property->getDeclaringClass()->getName() . $property->getName();
$logicalName = $property->getDeclaringClass()->getName() . '::' . $property->getName();
$propertyName = $property->getName();
$existingField = isset($this->reflFields[$propertyName]) ? $this->reflFields[$propertyName] : null;
@ -3382,8 +3386,8 @@ class ClassMetadataInfo implements ClassMetadata
$properties[$logicalName] = $existingField;
}
$parentClass = $class->getParentClass();
} while ($parentClass && $class = $reflectionService->getClass($parentClass->getName()));
$parentClass = $currentClass->getParentClass();
} while ($parentClass && $currentClass = $reflectionService->getClass($parentClass->getName()));
$this->reflectionProperties = array_values($properties);
}