1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00

subquery aliases now mapped to aliasMap

This commit is contained in:
zYne 2007-05-24 17:22:43 +00:00
parent 074a434ae2
commit 7e953aa240
2 changed files with 5 additions and 10 deletions

View file

@ -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;

View file

@ -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();
} }