1
0
mirror of synced 2025-01-29 19:41:45 +03:00

Added copy() method to Query.php and made NestedSet.php use it because native clone() does not work. Also Added ->getSql() to getRootAlias() so that _aliasMap is present after the parsing.

This commit is contained in:
Jonathan.Wage 2007-08-14 16:37:48 +00:00
parent 39e024c166
commit 7f4abdf292
3 changed files with 17 additions and 2 deletions

View File

@ -179,6 +179,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
*/
public function getRootAlias()
{
$this->getSql();
reset($this->_aliasMap);
return key($this->_aliasMap);

View File

@ -1531,4 +1531,17 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
return $this->execute($params);
}
}
public function copy(Doctrine_Query $query = null)
{
if( !$query )
{
$query = $this;
}
$new = new Doctrine_Query();
$new->_dqlParts = $query->_dqlParts;
return $new;
}
}

View File

@ -269,7 +269,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
if (!isset($this->_baseQuery)) {
$this->_baseQuery = $this->_createBaseQuery();
}
return clone $this->_baseQuery;
return $this->_baseQuery->copy();
}
/**