mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #10450] Failing test: Duplicate private fields not detected #12375
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/10450
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 private property named
field.Technically, that's two properties on two separate classes. Also, the mapping configuration given suggests to put both properties into separate database columns.
However, the ORM was not designed to make this distinction. For example,
ClassMetadata::$fieldMappingsis indexed by "field name" – there is no room for juggling with duplicate private fields being declared in different classes. This design limitation that would be very hard to change, should be documented as a limitation and be rejected when it is noticed. The same applies to association mappings and embeddables.Due to a quirk in the way the annotation and attribute drivers report fields (see #10417), the property will be skipped on the subclass. So, the property and mapping configuration will be picked up from the first (parent) class, and mapping configuration for
GH10450ChildClass::$fieldwill never be considered. The property will silently remain unmapped.