|
34 | 34 | class AnnotationDriver extends CompatibilityAnnotationDriver |
35 | 35 | { |
36 | 36 | use ColocatedMappingDriver; |
| 37 | + use ReflectionBasedDriverTrait; |
37 | 38 |
|
38 | 39 | /** |
39 | 40 | * The annotation reader. |
@@ -344,37 +345,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad |
344 | 345 |
|
345 | 346 | // Evaluate annotations on properties/fields |
346 | 347 | foreach ($class->getProperties() as $property) { |
347 | | - // Handle the case that reflection may report properties inherited from parent classes. |
348 | | - // When we know about the fields already (inheritance has been anticipanted in ClassMetadataFactory), |
349 | | - // skip them. |
350 | | - // The declaring classes may mismatch when there are private properties: The same property name may be |
351 | | - // reported multiple times, but since it is private, it is in fact multiple (different) properties in |
352 | | - // different classes. In that case, report the property as an individual field. (ClassMetadataFactory will |
353 | | - // probably fail in that case, though.) |
354 | | - |
355 | | - $declaringClass = $property->getDeclaringClass()->getName(); |
356 | | - |
357 | | - if ( |
358 | | - isset($metadata->fieldMappings[$property->name]) |
359 | | - && isset($metadata->fieldMappings[$property->name]['declared']) |
360 | | - && $metadata->fieldMappings[$property->name]['declared'] === $declaringClass |
361 | | - ) { |
362 | | - continue; |
363 | | - } |
364 | | - |
365 | | - if ( |
366 | | - isset($metadata->associationMappings[$property->name]) |
367 | | - && isset($metadata->associationMappings[$property->name]['declared']) |
368 | | - && $metadata->associationMappings[$property->name]['declared'] === $declaringClass |
369 | | - ) { |
370 | | - continue; |
371 | | - } |
372 | | - |
373 | | - if ( |
374 | | - isset($metadata->embeddedClasses[$property->name]) |
375 | | - && isset($metadata->embeddedClasses[$property->name]['declared']) |
376 | | - && $metadata->embeddedClasses[$property->name]['declared'] === $declaringClass |
377 | | - ) { |
| 348 | + if ($this->isRepeatedPropertyDeclaration($property, $metadata)) { |
378 | 349 | continue; |
379 | 350 | } |
380 | 351 |
|
|
0 commit comments