1
0
mirror of synced 2025-01-18 06:21:40 +03:00
This commit is contained in:
zYne 2007-08-14 20:16:31 +00:00
parent 7c857b67c1
commit 201c6b8194

View File

@ -35,7 +35,7 @@ class Doctrine_Query_Groupby extends Doctrine_Query_Part
/**
* DQL GROUP BY PARSER
* parses the group by part of the query string
*
* @param string $str
* @return void
*/
@ -45,11 +45,17 @@ class Doctrine_Query_Groupby extends Doctrine_Query_Part
foreach (explode(',', $str) as $reference) {
$reference = trim($reference);
$e = explode('.', $reference);
$field = array_pop($e);
$ref = implode('.', $e);
$this->query->load($ref);
$r[] = $this->query->getTableAlias($ref) . '.' . $field;
if (count($e) > 1) {
$field = array_pop($e);
$ref = implode('.', $e);
$this->query->load($ref);
$r[] = $this->query->getTableAlias($ref) . '.' . $field;
} else {
$alias = end($e);
$r[] = $this->query->getAggregateAlias($alias);
}
}
return implode(', ', $r);
}