1
0
mirror of synced 2024-12-14 07:06:04 +03:00
This commit is contained in:
zYne 2007-05-15 10:18:34 +00:00
parent a430d22cf4
commit f44cad9c4e
2 changed files with 20 additions and 15 deletions

View File

@ -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);
}
$root = current($this->tables);
$table = $this->tables[$tableAlias];
reset($this->_aliasMap);
$map = current($this->tables);
$root = $map['table'];
$table = $this->_aliasMap[$componentAlias]['table'];
$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();
}
}
}
}

View File

@ -34,8 +34,11 @@ 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;
return $this->query;
}
}