Commit f44cad9c authored by zYne's avatar zYne

--no commit message

--no commit message
parent a430d22c
...@@ -340,12 +340,11 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable ...@@ -340,12 +340,11 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
{ {
$tableAlias = $this->getTableAlias($componentAlias); $tableAlias = $this->getTableAlias($componentAlias);
if ( ! isset($this->tables[$tableAlias])) { reset($this->_aliasMap);
throw new Doctrine_Query_Exception('Unknown component path ' . $componentAlias); $map = current($this->tables);
} $root = $map['table'];
$table = $this->_aliasMap[$componentAlias]['table'];
$root = current($this->tables);
$table = $this->tables[$tableAlias];
$aggregates = array(); $aggregates = array();
if(isset($this->pendingAggregates[$componentAlias])) { if(isset($this->pendingAggregates[$componentAlias])) {
...@@ -369,8 +368,8 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable ...@@ -369,8 +368,8 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
if (is_numeric($arg)) { if (is_numeric($arg)) {
$arglist[] = $arg; $arglist[] = $arg;
} elseif (count($e) > 1) { } elseif (count($e) > 1) {
//$tableAlias = $this->getTableAlias($e[0]); $map = $this->_aliasMap[$e[0]];
$table = $this->tables[$tableAlias]; $table = $map['table'];
$e[1] = $table->getColumnName($e[1]); $e[1] = $table->getColumnName($e[1]);
...@@ -896,7 +895,10 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable ...@@ -896,7 +895,10 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
$restoreState = false; $restoreState = false;
// load fields if necessary // load fields if necessary
if ($loadFields && empty($this->pendingFields)) { if ($loadFields && empty($this->pendingFields)
&& empty($this->pendingAggregates)
&& empty($this->pendingSubqueries)) {
$this->pendingFields[$componentAlias] = array('*'); $this->pendingFields[$componentAlias] = array('*');
$restoreState = true; $restoreState = true;
...@@ -906,14 +908,14 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable ...@@ -906,14 +908,14 @@ class Doctrine_Query2 extends Doctrine_Hydrate2 implements Countable
$this->processPendingFields($componentAlias); $this->processPendingFields($componentAlias);
} }
if ($restoreState) {
$this->pendingFields = array();
}
if(isset($this->pendingAggregates[$componentAlias]) || isset($this->pendingAggregates[0])) { if(isset($this->pendingAggregates[$componentAlias]) || isset($this->pendingAggregates[0])) {
$this->processPendingAggregates($componentAlias); $this->processPendingAggregates($componentAlias);
} }
if ($restoreState) {
$this->pendingFields = array();
$this->pendingAggregates = array();
}
} }
} }
} }
......
...@@ -34,6 +34,9 @@ class Doctrine_Query_Select extends Doctrine_Query_Part ...@@ -34,6 +34,9 @@ class Doctrine_Query_Select extends Doctrine_Query_Part
{ {
public function parse($dql) public function parse($dql)
{ {
if ($dql === '' || $dql === null) {
throw new Doctrine_Query_Exception('Empty select part given.');
}
$this->query->parseSelect($dql); $this->query->parseSelect($dql);
return $this->query; return $this->query;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment