From 714a42239b61894900d4790f72a13ccd4a2badeb Mon Sep 17 00:00:00 2001 From: zYne Date: Mon, 13 Aug 2007 21:23:56 +0000 Subject: [PATCH] --- lib/Doctrine/Query/Where.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/Query/Where.php b/lib/Doctrine/Query/Where.php index 9bf9bb6c5..fe9ca7f94 100644 --- a/lib/Doctrine/Query/Where.php +++ b/lib/Doctrine/Query/Where.php @@ -63,11 +63,18 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition $field = array_pop($a); $reference = implode('.', $a); - $map = $this->query->load($reference, false); - - $alias = $this->query->getTableAlias($reference); - $table = $map['table']; - + + if (empty($reference)) { + $map = $this->query->getRootDeclaration(); + + $alias = $this->query->getTableAlias($this->query->getRootAlias()); + $table = $map['table']; + } else { + $map = $this->query->load($reference, false); + + $alias = $this->query->getTableAlias($reference); + $table = $map['table']; + } if ($this->query->getType() === Doctrine_Query::SELECT) { $first = $conn->quoteIdentifier($alias) . '.'