From 78f683d855bd07adac7a9b39094880b2e6dd2ccf Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 9 Aug 2007 17:31:31 +0000 Subject: [PATCH] fixes #424 --- lib/Doctrine/Query.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index 094129781..a3968abf8 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -1280,6 +1280,8 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable $join = ($delimeter == ':') ? 'INNER JOIN ' : 'LEFT JOIN '; $relation = $table->getRelation($name); + $localTable = $table; + $table = $relation->getTable(); $this->_aliasMap[$componentAlias] = array('table' => $table, 'parent' => $parent, @@ -1321,7 +1323,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable $queryPart .= ' ON ' . $localAlias . '.' - . $table->getColumnName($table->getIdentifier()) + . $localTable->getIdentifier() . ' = ' . $assocAlias . '.' . $relation->getLocal();