Commit d49c6cab authored by zYne's avatar zYne

--no commit message

--no commit message
parent b9f7f07a
......@@ -22,7 +22,7 @@
/**
* Doctrine_Hydrate is a base class for Doctrine_RawSql and Doctrine_Query.
* Its purpose is to populate object graphs.
*
*
*
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
......@@ -171,6 +171,30 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
}
$this->_conn = $connection;
}
/**
* getRootAlias
* returns the alias of the the root component
*
* @return array
*/
public function getRootAlias()
{
reset($this->_aliasMap);
return key($this->_aliasMap);
}
/**
* getRootDeclaration
* returns the root declaration
*
* @return array
*/
public function getRootDeclaration()
{
$map = reset($this->_aliasMap);
return $map;
}
/**
* getRoot
* returns the root component for this object
......@@ -374,7 +398,11 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
if ( ! isset($this->_tableAliasSeeds[$alias])) {
$this->_tableAliasSeeds[$alias] = 1;
}
while (isset($this->_tableAliases[$alias])) {
if ( ! isset($this->_tableAliasSeeds[$alias])) {
$this->_tableAliasSeeds[$alias] = 1;
}
$alias = $char . ++$this->_tableAliasSeeds[$alias];
}
......@@ -558,7 +586,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
public function copyAliases(Doctrine_Hydrate $query)
{
$this->_tableAliases = $query->_tableAliases;
$this->_aliasMap = $query->_aliasMap;
$this->_tableAliasSeeds = $query->_tableAliasSeeds;
return $this;
}
/**
......
......@@ -283,7 +283,6 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
throw new Doctrine_Query_Exception('This query object is locked. No query parts can be manipulated.');
}
// sanity check
if ($queryPart === '' || $queryPart === null) {
throw new Doctrine_Query_Exception('Empty ' . $queryPartName . ' part given.');
......@@ -529,7 +528,9 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
foreach ($this->pendingSubqueries as $value) {
list($dql, $alias) = $value;
$sql = $this->createSubquery()->parseQuery($dql, false)->getQuery();
$subquery = $this->createSubquery();
$sql = $subquery->parseQuery($dql, false)->getQuery();
reset($this->_aliasMap);
$componentAlias = key($this->_aliasMap);
......@@ -727,10 +728,11 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$parts = $this->_dqlParts;
// reset the state
$this->_aliasMap = array();
$this->pendingAggregates = array();
$this->aggregateMap = array();
if ( ! $this->isSubquery()) {
$this->_aliasMap = array();
$this->pendingAggregates = array();
$this->aggregateMap = array();
}
$this->reset();
// parse the DQL parts
......@@ -1238,7 +1240,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
}
} else {
$queryPart = $join . $foreignSql
. ' ON '
. $this->_conn->quoteIdentifier($localAlias . '.' . $relation->getLocal())
......
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