mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Trait metadata overriding fails for MappedSuperclass #5719
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @origaminal on GitHub (Sep 29, 2017).
If one will try to define some metadata in a trait and then to override this metadata in the
MappedSuperclassthat uses the trait he will fail in the case properties were not set asprivate. The issue is described on StackOverflow https://stackoverflow.com/questions/46354858/override-association-mapping-of-a-trait-property-in-doctrine-2-6I wrote the test case that succeeds on the attempt to override a private property and fails on the attempt to override a protected property.
367b11b86dThe root of the issue is in the
AnnotationDriver's code:53245e8a73/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php (L277-L286)It skips all non-private properties for a
MappedSuperclassand therefore they do not appear in its metadata definition.When the driver tries to do the overriding:
53245e8a73/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php (L478)He fails to find the overridden property in the metadata and throws an exception.