Commit 201c6b81 authored by zYne's avatar zYne

fixes #419

parent 7c857b67
...@@ -35,7 +35,7 @@ class Doctrine_Query_Groupby extends Doctrine_Query_Part ...@@ -35,7 +35,7 @@ class Doctrine_Query_Groupby extends Doctrine_Query_Part
/** /**
* DQL GROUP BY PARSER * DQL GROUP BY PARSER
* parses the group by part of the query string * parses the group by part of the query string
*
* @param string $str * @param string $str
* @return void * @return void
*/ */
...@@ -45,11 +45,17 @@ class Doctrine_Query_Groupby extends Doctrine_Query_Part ...@@ -45,11 +45,17 @@ class Doctrine_Query_Groupby extends Doctrine_Query_Part
foreach (explode(',', $str) as $reference) { foreach (explode(',', $str) as $reference) {
$reference = trim($reference); $reference = trim($reference);
$e = explode('.', $reference); $e = explode('.', $reference);
if (count($e) > 1) {
$field = array_pop($e); $field = array_pop($e);
$ref = implode('.', $e); $ref = implode('.', $e);
$this->query->load($ref); $this->query->load($ref);
$r[] = $this->query->getTableAlias($ref) . '.' . $field; $r[] = $this->query->getTableAlias($ref) . '.' . $field;
} else {
$alias = end($e);
$r[] = $this->query->getAggregateAlias($alias);
}
} }
return implode(', ', $r); return implode(', ', $r);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment