[PR #8348] [GH-8229] Prevent Illegal Inheritance Override #10936

Open
opened 2026-01-22 16:09:10 +01:00 by admin · 0 comments
Owner

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:

One excemption was made to use @AssocationOVerride only 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.

**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 `@AssocationOVerride` only 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.
admin added the pull-request label 2026-01-22 16:09:10 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#10936