This commit is contained in:
parent
a430d22cf4
commit
f44cad9c4e
@ -340,12 +340,11 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
|
||||
{
|
||||
$tableAlias = $this->getTableAlias($componentAlias);
|
||||
|
||||
if ( ! isset($this->tables[$tableAlias])) {
|
||||
throw new Doctrine_Query_Exception('Unknown component path ' . $componentAlias);
|
||||
}
|
||||
reset($this->_aliasMap);
|
||||
$map = current($this->tables);
|
||||
$root = $map['table'];
|
||||
$table = $this->_aliasMap[$componentAlias]['table'];
|
||||
|
||||
$root = current($this->tables);
|
||||
$table = $this->tables[$tableAlias];
|
||||
$aggregates = array();
|
||||
|
||||
if(isset($this->pendingAggregates[$componentAlias])) {
|
||||
@ -369,8 +368,8 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
|
||||
if (is_numeric($arg)) {
|
||||
$arglist[] = $arg;
|
||||
} elseif (count($e) > 1) {
|
||||
//$tableAlias = $this->getTableAlias($e[0]);
|
||||
$table = $this->tables[$tableAlias];
|
||||
$map = $this->_aliasMap[$e[0]];
|
||||
$table = $map['table'];
|
||||
|
||||
$e[1] = $table->getColumnName($e[1]);
|
||||
|
||||
@ -896,7 +895,10 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
|
||||
|
||||
$restoreState = false;
|
||||
// load fields if necessary
|
||||
if ($loadFields && empty($this->pendingFields)) {
|
||||
if ($loadFields && empty($this->pendingFields)
|
||||
&& empty($this->pendingAggregates)
|
||||
&& empty($this->pendingSubqueries)) {
|
||||
|
||||
$this->pendingFields[$componentAlias] = array('*');
|
||||
|
||||
$restoreState = true;
|
||||
@ -906,14 +908,14 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
|
||||
$this->processPendingFields($componentAlias);
|
||||
}
|
||||
|
||||
if ($restoreState) {
|
||||
$this->pendingFields = array();
|
||||
}
|
||||
|
||||
|
||||
if(isset($this->pendingAggregates[$componentAlias]) || isset($this->pendingAggregates[0])) {
|
||||
$this->processPendingAggregates($componentAlias);
|
||||
}
|
||||
|
||||
if ($restoreState) {
|
||||
$this->pendingFields = array();
|
||||
$this->pendingAggregates = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ class Doctrine_Query_Select extends Doctrine_Query_Part
|
||||
{
|
||||
public function parse($dql)
|
||||
{
|
||||
if ($dql === '' || $dql === null) {
|
||||
throw new Doctrine_Query_Exception('Empty select part given.');
|
||||
}
|
||||
$this->query->parseSelect($dql);
|
||||
|
||||
return $this->query;
|
||||
|
Loading…
Reference in New Issue
Block a user