refs #174 - probably fixes, zYne- please check... tests are currently broken
This commit is contained in:
parent
cab5b432a6
commit
6f6ce2424e
@ -405,7 +405,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
|
|||||||
$agg = false;
|
$agg = false;
|
||||||
|
|
||||||
if(isset($this->pendingAggregates[$alias][$index]))
|
if(isset($this->pendingAggregates[$alias][$index]))
|
||||||
$agg = $this->pendingAggregates[$alias][$index][0];
|
$agg = $this->pendingAggregates[$alias][$index][3];
|
||||||
|
|
||||||
$prev[$name]->setAggregateValue($agg, $value);
|
$prev[$name]->setAggregateValue($agg, $value);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
|
|||||||
case 'MIN':
|
case 'MIN':
|
||||||
case 'COUNT':
|
case 'COUNT':
|
||||||
case 'AVG':
|
case 'AVG':
|
||||||
|
case 'SUM':
|
||||||
$reference = substr($func, ($pos + 1), -1);
|
$reference = substr($func, ($pos + 1), -1);
|
||||||
$e2 = explode(' ', $reference);
|
$e2 = explode(' ', $reference);
|
||||||
|
|
||||||
@ -163,7 +164,8 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
|
|||||||
$parts = explode('.', $reference);
|
$parts = explode('.', $reference);
|
||||||
|
|
||||||
$alias = (isset($e[1])) ? $e[1] : $name;
|
$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;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Doctrine_Query_Exception('Unknown aggregate function '.$name);
|
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];
|
$table = $this->components[$componentPath];
|
||||||
|
|
||||||
foreach($this->pendingAggregates[$componentAlias] as $args) {
|
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);
|
$this->parts["select"][] = $name . '(' . $distinct . $tableAlias . '.' . $arg . ') AS ' . $tableAlias . '__' . count($this->aggregateMap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user