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:
parent
39e024c166
commit
7f4abdf292
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user