From 3b48b7911c0a4d8f993876d7aaaf23ba3b73afd4 Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 26 Apr 2007 18:06:16 +0000 Subject: [PATCH] --- lib/Doctrine/Query/Having.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Query/Having.php b/lib/Doctrine/Query/Having.php index 32b082b00..c60451168 100644 --- a/lib/Doctrine/Query/Having.php +++ b/lib/Doctrine/Query/Having.php @@ -60,14 +60,16 @@ class Doctrine_Query_Having extends Doctrine_Query_Condition } else { if ( ! is_numeric($func)) { $a = explode('.', $func); - $field = array_pop($a); + if (count($a) > 1) { + $field = array_pop($a); $reference = implode('.', $a); $table = $this->query->load($reference, false); $field = $table->getColumnName($field); $func = $this->query->getTableAlias($reference) . '.' . $field; } else { - $func = $this->query->getAggregateAlias($field); + $field = end($a); + $func = $this->query->getAggregateAlias($field); } return $func; } else {