Commit 7f4abdf2 authored by Jonathan.Wage's avatar Jonathan.Wage

Added copy() method to Query.php and made NestedSet.php use it because native...

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.
parent 39e024c1
......@@ -179,6 +179,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
*/
public function getRootAlias()
{
$this->getSql();
reset($this->_aliasMap);
return key($this->_aliasMap);
......
......@@ -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;
}
}
\ No newline at end of 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();
}
/**
......
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