mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #656] [CLOSED] [DDC-2235] Fix for using a LEFT JOIN onto an entity with single table inheritance #8513
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?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/656
Author: @tarnfeld
Created: 4/28/2013
Status: ❌ Closed
Base:
master← Head:master📝 Commits (7)
6877610Initial idea for fixing doctrine bug DDC-2235.615c25aAdjusted whitespace and added unit tests080c3e3Spelling8ecc571Moved theIN()predicate into theONclause of the join1d86983Small code cleanliness bits6db2ff0Typo0d4d08cCoding standards📊 Changes
2 files changed (+63 additions, -3 deletions)
View changed files
📝
lib/Doctrine/ORM/Query/SqlWalker.php(+14 -3)📝
tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php(+49 -0)📄 Description
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 makes theLEFT JOINpretty much useless, as it implicitly creates aWHERE NOT NULLclause. This commit attempts to fix that by including anOR IS NULLin the query if the join is aLEFT 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.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.