|
18 | 18 | use Doctrine\ORM\Utility\IdentifierFlattener;
|
19 | 19 | use Doctrine\Persistence\Mapping\ClassMetadata;
|
20 | 20 | use Doctrine\Persistence\Proxy;
|
| 21 | +use ReflectionProperty; |
21 | 22 | use Symfony\Component\VarExporter\ProxyHelper;
|
22 | 23 | use Symfony\Component\VarExporter\VarExporter;
|
23 | 24 |
|
@@ -313,17 +314,24 @@ private function generateSkippedProperties(ClassMetadata $class): string
|
313 | 314 | {
|
314 | 315 | $skippedProperties = ['__isCloning' => true];
|
315 | 316 | $identifiers = array_flip($class->getIdentifierFieldNames());
|
| 317 | + $filter = ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE; |
| 318 | + $reflector = $class->getReflectionClass(); |
316 | 319 |
|
317 |
| - foreach ($class->getReflectionClass()->getProperties() as $property) { |
318 |
| - $name = $property->getName(); |
| 320 | + while ($reflector) { |
| 321 | + foreach ($reflector->getProperties($filter) as $property) { |
| 322 | + $name = $property->getName(); |
319 | 323 |
|
320 |
| - if ($property->isStatic() || (($class->hasField($name) || $class->hasAssociation($name)) && ! isset($identifiers[$name]))) { |
321 |
| - continue; |
322 |
| - } |
| 324 | + if ($property->isStatic() || (($class->hasField($name) || $class->hasAssociation($name)) && ! isset($identifiers[$name]))) { |
| 325 | + continue; |
| 326 | + } |
323 | 327 |
|
324 |
| - $prefix = $property->isPrivate() ? "\0" . $property->getDeclaringClass()->getName() . "\0" : ($property->isProtected() ? "\0*\0" : ''); |
| 328 | + $prefix = $property->isPrivate() ? "\0" . $property->getDeclaringClass()->getName() . "\0" : ($property->isProtected() ? "\0*\0" : ''); |
| 329 | + |
| 330 | + $skippedProperties[$prefix . $name] = true; |
| 331 | + } |
325 | 332 |
|
326 |
| - $skippedProperties[$prefix . $name] = true; |
| 333 | + $filter = ReflectionProperty::IS_PRIVATE; |
| 334 | + $reflector = $reflector->getParentClass(); |
327 | 335 | }
|
328 | 336 |
|
329 | 337 | uksort($skippedProperties, 'strnatcmp');
|
|
0 commit comments