mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2250: Joining Associations in Single Inheritance Scheme #2831
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 @doctrinebot on GitHub (Jan 20, 2013).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user johannes:
Let's assume the following class hierarchy:
Now, I'd like to write a query such as:
The idea is to preload the association when selecting all comments. Now, that association is only present on a sub-class of the queried class, but since it is a single table inheritance, Doctrine should be able to join it for those entities where it is present.
At the moment unfortunately, Doctrine shows an error that the association does not exist on the AbstractComment class. Also, there is no real alternative to this except moving the collection to the base class even if it does not belong there.
@doctrinebot commented on GitHub (Jan 20, 2013):
Comment created by @beberlei:
DQL has strict typing with regard to inheritance, this type of query is not possible.
@doctrinebot commented on GitHub (Jan 20, 2013):
Issue was closed with resolution "Can't Fix"
@doctrinebot commented on GitHub (Jan 20, 2013):
Comment created by johannes:
A too bad. I guess the code around inheritance is already quite complex that it does not make sense to add an exception for this case.
Do you think it would somehow (maybe manually) be possible to load collections in a batch operation? For example, something like this: