DDC-2704 - handling partial initialization of the class as expected (class metadata may not hold reflection class after wakeup)
This commit is contained in:
parent
1e6c071bb8
commit
a4982a8dc2
@ -3347,20 +3347,24 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
*/
|
*/
|
||||||
private function initializeAllReflectionProperties(ReflectionService $reflectionService)
|
private function initializeAllReflectionProperties(ReflectionService $reflectionService)
|
||||||
{
|
{
|
||||||
$class = $this->reflClass;
|
if (! $this->reflClass) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentClass = $this->reflClass;
|
||||||
$properties = array();
|
$properties = array();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$className = $class->getName();
|
$className = $currentClass->getName();
|
||||||
|
|
||||||
foreach ($class->getProperties() as $property) {
|
foreach ($currentClass->getProperties() as $property) {
|
||||||
// static properties are not instance properties
|
// static properties are not instance properties
|
||||||
if ($property->isStatic()) {
|
if ($property->isStatic()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// indexing by logical name to avoid duplicates
|
// indexing by logical name to avoid duplicates
|
||||||
$logicalName = $property->getDeclaringClass()->getName() . $property->getName();
|
$logicalName = $property->getDeclaringClass()->getName() . '::' . $property->getName();
|
||||||
$propertyName = $property->getName();
|
$propertyName = $property->getName();
|
||||||
$existingField = isset($this->reflFields[$propertyName]) ? $this->reflFields[$propertyName] : null;
|
$existingField = isset($this->reflFields[$propertyName]) ? $this->reflFields[$propertyName] : null;
|
||||||
|
|
||||||
@ -3382,8 +3386,8 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
$properties[$logicalName] = $existingField;
|
$properties[$logicalName] = $existingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parentClass = $class->getParentClass();
|
$parentClass = $currentClass->getParentClass();
|
||||||
} while ($parentClass && $class = $reflectionService->getClass($parentClass->getName()));
|
} while ($parentClass && $currentClass = $reflectionService->getClass($parentClass->getName()));
|
||||||
|
|
||||||
$this->reflectionProperties = array_values($properties);
|
$this->reflectionProperties = array_values($properties);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user