subquery aliases now mapped to aliasMap
This commit is contained in:
parent
074a434ae2
commit
7e953aa240
2 changed files with 5 additions and 10 deletions
|
@ -81,16 +81,14 @@ class Doctrine_Hydrate
|
||||||
* relation the relation object owned by the parent
|
* relation the relation object owned by the parent
|
||||||
*
|
*
|
||||||
* parent the alias of the parent
|
* parent the alias of the parent
|
||||||
|
*
|
||||||
|
* subAgg the subquery aggregates of this component
|
||||||
*/
|
*/
|
||||||
protected $_aliasMap = array();
|
protected $_aliasMap = array();
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected $pendingAggregates = array();
|
protected $pendingAggregates = array();
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected $subqueryAggregates = array();
|
|
||||||
/**
|
/**
|
||||||
* @var array $aggregateMap an array containing all aggregate aliases, keys as dql aliases
|
* @var array $aggregateMap an array containing all aggregate aliases, keys as dql aliases
|
||||||
* and values as sql aliases
|
* and values as sql aliases
|
||||||
|
@ -335,8 +333,8 @@ class Doctrine_Hydrate
|
||||||
|
|
||||||
if (isset($this->pendingAggregates[$alias][$index])) {
|
if (isset($this->pendingAggregates[$alias][$index])) {
|
||||||
$agg = $this->pendingAggregates[$alias][$index][3];
|
$agg = $this->pendingAggregates[$alias][$index][3];
|
||||||
} elseif (isset($this->subqueryAggregates[$alias][$index])) {
|
} elseif (isset($this->_aliasMap[$alias]['subAgg'][$index])) {
|
||||||
$agg = $this->subqueryAggregates[$alias][$index];
|
$agg = $this->_aliasMap[$alias]['subAgg'][$index];
|
||||||
}
|
}
|
||||||
$record->mapValue($agg, $value);
|
$record->mapValue($agg, $value);
|
||||||
$found = true;
|
$found = true;
|
||||||
|
|
|
@ -32,9 +32,6 @@ Doctrine::autoload('Doctrine_Query_Abstract');
|
||||||
*/
|
*/
|
||||||
class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
|
class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param array $subqueryAliases the table aliases needed in some LIMIT subqueries
|
|
||||||
*/
|
|
||||||
protected $subqueryAliases = array();
|
protected $subqueryAliases = array();
|
||||||
/**
|
/**
|
||||||
* @param boolean $needsSubquery
|
* @param boolean $needsSubquery
|
||||||
|
@ -441,7 +438,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
|
||||||
$this->parts['select'][] = '(' . $sql . ') AS ' . $sqlAlias;
|
$this->parts['select'][] = '(' . $sql . ') AS ' . $sqlAlias;
|
||||||
|
|
||||||
$this->aggregateMap[$alias] = $sqlAlias;
|
$this->aggregateMap[$alias] = $sqlAlias;
|
||||||
$this->subqueryAggregates[$componentAlias][] = $alias;
|
$this->_aliasMap[$componentAlias]['subAgg'][] = $alias;
|
||||||
}
|
}
|
||||||
$this->pendingSubqueries = array();
|
$this->pendingSubqueries = array();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue