mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #10454] Failing test: Re-configured protected property not rejected #12374
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?
Original Pull Request: https://github.com/doctrine/orm/pull/10454
State: closed
Merged: No
This has been merged through #10455.
This test case demonstrates two situations where an entity inherits from another entity or a mapped superclass. Both (parent and child) classes have a protected property named
field. In other words, the child class overwrites the property and re-configures the mapping information.The
ClassMetadataFactoryand other components were not designed to work with such a configuration. Just imagine a situation where an entity base class configures this field on one way, and a subclass in different way – let's say the subclass uses anothernamefor the database column. How should the ORM work with this configuration when using STI or JTI, when querying entities through the root or a leaf class?The exception rejecting this kind of configuration has been present since the early days:
70477d81e9/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php (L2724)However, due to quirks in the mapping drivers (see #10417), the duplicated field was never reported to the
ClassMetadataFactory, and due to a missing test case for the mis-configuration, this was never noticed.