1
0
mirror of synced 2024-12-13 14:56:01 +03:00

refs #174 - probably fixes, zYne- please check... tests are currently broken

This commit is contained in:
pookey 2006-12-02 07:55:15 +00:00
parent cab5b432a6
commit 6f6ce2424e
2 changed files with 5 additions and 3 deletions

View File

@ -405,7 +405,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
$agg = false;
if(isset($this->pendingAggregates[$alias][$index]))
$agg = $this->pendingAggregates[$alias][$index][0];
$agg = $this->pendingAggregates[$alias][$index][3];
$prev[$name]->setAggregateValue($agg, $value);
}

View File

@ -149,6 +149,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
case 'MIN':
case 'COUNT':
case 'AVG':
case 'SUM':
$reference = substr($func, ($pos + 1), -1);
$e2 = explode(' ', $reference);
@ -163,7 +164,8 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$parts = explode('.', $reference);
$alias = (isset($e[1])) ? $e[1] : $name;
$this->pendingAggregates[$parts[0]][] = array($alias, $parts[1], $distinct);
$this->pendingAggregates[$parts[0]][] = array($name, $parts[1], $distinct, $alias);
break;
default:
throw new Doctrine_Query_Exception('Unknown aggregate function '.$name);
@ -180,7 +182,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$table = $this->components[$componentPath];
foreach($this->pendingAggregates[$componentAlias] as $args) {
list($name, $arg, $distinct) = $args;
list($name, $arg, $distinct, $alias) = $args;
$this->parts["select"][] = $name . '(' . $distinct . $tableAlias . '.' . $arg . ') AS ' . $tableAlias . '__' . count($this->aggregateMap);