1
0
mirror of synced 2025-01-18 22:41:43 +03:00
This commit is contained in:
zYne 2007-04-13 18:06:48 +00:00
parent 0d2e83ff8a
commit 3ffe5d0f9d

View File

@ -1203,18 +1203,18 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* @return Doctrine_Record
*/
public function copyDeep(){
$newObject = $this->copy();
foreach( $this->getTable()->getRelations() as $relation ) {
if ( $relation->getType() == Doctrine_Relation::MANY_COMPOSITE ||
$relation->getType() == Doctrine_Relation::ONE_COMPOSITE ) {
$alias = $relation->getAlias();
foreach ( $this->$alias as $relatedObject ) {
$newRelatedObject = $relatedObject->copyDeep();
$newObject->{$alias}[] = $newRelatedObject;
$copy = $this->copy();
foreach ($this->references as $key => $value) {
if ($value instanceof Doctrine_Collection) {
foreach ($value as $record) {
$copy->{$key}[] = $record->copyDeep();
}
} else {
$copy->set($key, $value->copyDeep());
}
}
}
return $newObject;
return $copy;
}
/**
@ -1637,15 +1637,18 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*
* @return mixed if tree returns Doctrine_Node otherwise returns false
*/
public function getNode() {
if(!$this->_table->isTree())
public function getNode()
{
if ( ! $this->_table->isTree()) {
return false;
}
if(!isset($this->_node))
if ( ! isset($this->_node)) {
$this->_node = Doctrine_Node::factory($this,
$this->getTable()->getOption('treeImpl'),
$this->getTable()->getOption('treeOptions')
);
}
return $this->_node;
}