From c7ac5650c27909183fbf5870fb66fc73cdd2b1ca Mon Sep 17 00:00:00 2001 From: guilhermeblanco Date: Mon, 15 Mar 2010 19:04:14 +0000 Subject: [PATCH] [2.0] Fixed issue with Subselect not handling well inheritance type JOINED. --- lib/Doctrine/ORM/Query/SqlWalker.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 9f1a269b2..2cd6895dc 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -1012,12 +1012,16 @@ class SqlWalker implements TreeWalker $identificationVarDecls = $subselectFromClause->identificationVariableDeclarations; $firstIdentificationVarDecl = $identificationVarDecls[0]; $rangeDecl = $firstIdentificationVarDecl->rangeVariableDeclaration; - $class = $this->_em->getClassMetadata($rangeDecl->abstractSchemaName); $dqlAlias = $rangeDecl->aliasIdentificationVariable; + $class = $this->_em->getClassMetadata($rangeDecl->abstractSchemaName); $sql = ' FROM ' . $class->getQuotedTableName($this->_platform) . ' ' . $this->getSqlTableAlias($class->primaryTable['name'], $dqlAlias); + if ($class->isInheritanceTypeJoined()) { + $sql .= $this->_generateClassTableInheritanceJoins($class, $dqlAlias); + } + foreach ($firstIdentificationVarDecl->joinVariableDeclarations as $joinVarDecl) { $sql .= $this->walkJoinVariableDeclaration($joinVarDecl); }