From c6810861ca3cbcfc846a50c59e06681d84604332 Mon Sep 17 00:00:00 2001 From: Strate Date: Sun, 22 Dec 2013 21:02:14 +0400 Subject: [PATCH] Fix applying ON/WITH conditions to first join in Class Table Inheritance --- lib/Doctrine/ORM/Query/SqlWalker.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 37f970843..549fe8d2d 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -982,6 +982,11 @@ class SqlWalker implements TreeWalker break; } + // FIXME: these should either be nested or all forced to be left joins (DDC-XXX) + if ($targetClass->isInheritanceTypeJoined()) { + $sql .= $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias); + } + // Handle WITH clause if ($condExpr !== null) { // Phase 2 AST optimization: Skip processing of ConditionalExpression @@ -989,11 +994,6 @@ class SqlWalker implements TreeWalker $sql .= ' AND (' . $this->walkConditionalExpression($condExpr) . ')'; } - // FIXME: these should either be nested or all forced to be left joins (DDC-XXX) - if ($targetClass->isInheritanceTypeJoined()) { - $sql .= $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias); - } - // Apply the indexes if ($indexBy) { // For Many-To-One or One-To-One associations this obviously makes no sense, but is ignored silently.