Commit 3ffe5d0f authored by zYne's avatar zYne

--no commit message

--no commit message
parent 0d2e83ff
...@@ -79,7 +79,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -79,7 +79,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*/ */
protected $_table; protected $_table;
/** /**
* @var Doctrine_Node_<TreeImpl> node object * @var Doctrine_Node_<TreeImpl> node object
*/ */
protected $_node; protected $_node;
/** /**
...@@ -1190,7 +1190,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -1190,7 +1190,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$ret = $this->_table->create($this->_data); $ret = $this->_table->create($this->_data);
$modified = array(); $modified = array();
foreach ($this->_data as $key => $val) { foreach ($this->_data as $key => $val) {
if (!($val instanceof Doctrine_Null)) { if ( ! ($val instanceof Doctrine_Null)) {
$ret->_modified[] = $key; $ret->_modified[] = $key;
} }
} }
...@@ -1203,18 +1203,18 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -1203,18 +1203,18 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* @return Doctrine_Record * @return Doctrine_Record
*/ */
public function copyDeep(){ public function copyDeep(){
$newObject = $this->copy(); $copy = $this->copy();
foreach( $this->getTable()->getRelations() as $relation ) {
if ( $relation->getType() == Doctrine_Relation::MANY_COMPOSITE || foreach ($this->references as $key => $value) {
$relation->getType() == Doctrine_Relation::ONE_COMPOSITE ) { if ($value instanceof Doctrine_Collection) {
$alias = $relation->getAlias(); foreach ($value as $record) {
foreach ( $this->$alias as $relatedObject ) { $copy->{$key}[] = $record->copyDeep();
$newRelatedObject = $relatedObject->copyDeep();
$newObject->{$alias}[] = $newRelatedObject;
} }
} else {
$copy->set($key, $value->copyDeep());
} }
} }
return $newObject; return $copy;
} }
/** /**
...@@ -1637,24 +1637,27 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -1637,24 +1637,27 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* *
* @return mixed if tree returns Doctrine_Node otherwise returns false * @return mixed if tree returns Doctrine_Node otherwise returns false
*/ */
public function getNode() { public function getNode()
if(!$this->_table->isTree()) {
return false; if ( ! $this->_table->isTree()) {
return false;
}
if(!isset($this->_node)) if ( ! isset($this->_node)) {
$this->_node = Doctrine_Node::factory($this, $this->_node = Doctrine_Node::factory($this,
$this->getTable()->getOption('treeImpl'), $this->getTable()->getOption('treeImpl'),
$this->getTable()->getOption('treeOptions') $this->getTable()->getOption('treeOptions')
); );
}
return $this->_node; return $this->_node;
} }
/** /**
* used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE * used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE
* *
*/ */
public function deleteNode() { public function deleteNode() {
$this->getNode()->delete(); $this->getNode()->delete();
} }
/** /**
* returns a string representation of this object * returns a string representation of this object
......
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