mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2420: [GH-656] [DDC-2235] Fix for using a LEFT JOIN onto an entity with single table inheritance #3035
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 (Apr 28, 2013).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of tarnfeld:
Url: https://github.com/doctrine/doctrine2/pull/656
Message:
Possible fix for the bug DDC-2235. I'd love to hear some opinions on whether this is the right way to go about this issue. I'm not particularly familiar with the internals of doctrine so there may be a better solution.
The issue is when using DQL to perform a left join on an entity using single
table inheritance, doctrine tries to insert an
IN()predicate into theWHEREclause for all of the discriminator values. That makes sense and is valid, so
it would be wrong to remove that behaviour.
However when using a left join having an
IN()in the main where clause makesthe
LEFT JOINpretty much useless, as it implicitly creates aWHERE NOT NULLclause. This commit attempts to fix that by including an
OR IS NULLin thequery if the join is a
LEFT JOIN.I've added some regression tests to ensure this bug never creeps back in. They fail on master (highlighting the bug) and pass after these commits have been applied. I've also included a couple of other queries as tests to be sure only this one case has been affected.