mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #8348] [GH-8229] Prevent Illegal Inheritance Override #10936
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/8348
State: closed
Merged: Yes
The PRs #8234 and #8329 are based on a flawed understanding of inheritance in Doctrine and need to be reverted:
Attribute/Association Overrides are only allowed to be used for MappedSuperclass and Traits. This is documented, albeit not phrased strongly enough: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html#overrides
Entities are not allowed to extend from entities without an inheritence mapping relationship (Single Table or Joined Table inheritance). If you have this use case you should instead have two entities and they each extend a common
@MappedSuperclass.One excemption was made to use
@AssocationOVerrideonly for changing the fetch strategy. Soft-deprecated this with a TODO.While Doctrine so far allowed these things, they are fragile and will break on certain scenarios. Please give feedback here or in new issues on the impact of this change on your projects.