diff --git a/lib/Doctrine/Query/Having.php b/lib/Doctrine/Query/Having.php index 234cd70c0..01dc6f0f0 100644 --- a/lib/Doctrine/Query/Having.php +++ b/lib/Doctrine/Query/Having.php @@ -93,6 +93,10 @@ class Doctrine_Query_Having extends Doctrine_Query_Condition $operator = array_shift($tokens); $value = implode(' ', $tokens); $part .= ' ' . $operator . ' ' . $value; + // check the RHS for aggregate functions + if (strpos($value, '(') !== false) { + $value = $this->parseAggregateFunction($value); + } return $part; } }