mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Subentities with discriminator column in query result #5832
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 @fasterforward on GitHub (Jan 8, 2018).
Originally assigned to: @fasterforward on GitHub.
We have some problems querying an entity with embedded sub entities. First let me sketch the context:
In the mapping of Generalassuranceline the Possession is defined as a many-to-one relation (named 'object') to the generic Possession type, because at the Generalassuranceline level the 'object' can be either a Vehicle or a Misc entity.
(The detailed mappings of the entities are listed below.)
The DQL query we execute is the following:
Problem:
In the database, the offer we query has two offerlines. In the following situations, the output is generated by:
\Doctrine\Common\Util\Debug::dump($query->getResult(), 3);Situation 1:
If we specify the "object" relation in Generalassuranceline as type Possession, we only get one offerline entity in our result.
Situation 2:
If we specify the "object" relation in Generalassuranceline as type Vehicle, we get both the offerline entities as expected.
Can someone explain to us the reason why we get only one offerline entity in the offer result in situation 1 and what we can change to retrieve more reliable results?
Mappings:
Offer
Offerline
Generalassuranceline
Possession
Vehicle
Misc
@lcobucci commented on GitHub (Feb 22, 2018):
@fasterforward this seems a bit odd, could you please send us a failing test case that reproduces that behaviour? It would help us a lot to identify and fix the issue you're describing.
Since it's a bug you can use
2.6as base and we'll port it tomasterwhen/if needed.You can find examples on
388afb46d0/tests/Doctrine/Tests/ORM/Functional/Ticket