[PR #502] [MERGED] Fix for invalid 'double-ON' SQL generation with entity inheritance type JOINED. #8290

Closed
opened 2026-01-22 15:59:14 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/502
Author: @gws
Created: 11/5/2012
Status: Merged
Merged: 11/6/2012
Merged by: @guilhermeblanco

Base: masterHead: master


📝 Commits (1)

  • 9e916a2 Fix for invalid 'double-ON' SQL generation with entity inheritance type JOINED.

📊 Changes

2 files changed (+14 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/Query/SqlWalker.php (+6 -1)
📝 tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php (+8 -0)

📄 Description

In SqlWalker::walkJoin(), SqlWalker::walkRangeVariableDeclaration() can be
called which may produce an 'ON' clause if the entity inheritance type is
JOINED. As walkJoin() may then produce another ON clause, this results in
invalid SQL (e.g. '... ON foo = bar ON (baz = quux) ...' when the inheritance
type is JOINED.

This adds a test and a fix for the problem, by checking for an inheritance type
of JOINED in walkJoin() and using AND instead of ON in the appropriate place.

It seems like this part of the code is begging to be refactored. This is my
first foray into Doctrine internals and can't see a way to do this without
stomping all over the rest of the code, but this section seems ripe for cleanup
by somebody who is familiar.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/502 **Author:** [@gws](https://github.com/gws) **Created:** 11/5/2012 **Status:** ✅ Merged **Merged:** 11/6/2012 **Merged by:** [@guilhermeblanco](https://github.com/guilhermeblanco) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`9e916a2`](https://github.com/doctrine/orm/commit/9e916a2893d0fa9377d2ad8582d6b2d40070ce67) Fix for invalid 'double-ON' SQL generation with entity inheritance type JOINED. ### 📊 Changes **2 files changed** (+14 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Query/SqlWalker.php` (+6 -1) 📝 `tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php` (+8 -0) </details> ### 📄 Description In SqlWalker::walkJoin(), SqlWalker::walkRangeVariableDeclaration() can be called which may produce an 'ON' clause if the entity inheritance type is JOINED. As walkJoin() may then produce another ON clause, this results in invalid SQL (e.g. '... ON foo = bar ON (baz = quux) ...' when the inheritance type is JOINED. This adds a test and a fix for the problem, by checking for an inheritance type of JOINED in walkJoin() and using AND instead of ON in the appropriate place. It seems like this part of the code is begging to be refactored. This is my first foray into Doctrine internals and can't see a way to do this without stomping all over the rest of the code, but this section seems ripe for cleanup by somebody who is familiar. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:59:14 +01:00
admin closed this issue 2026-01-22 15:59:15 +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#8290