Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion main/UnifiedContainer/UnifiedContainer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ public function __wakeup()
$this->dao = Singleton::getInstance($this->daoClass);
$this->worker = new $this->workerClass($this);
}


public function __clone() {
$this->worker = clone $this->worker;
}

public function getParentObject()
{
return $this->parent;
Expand Down
10 changes: 10 additions & 0 deletions test/db/CountAndUnifiedDBTest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ public function unified()
return null;

$this->assertEquals($user->getEncapsulants()->getCount(), 10);

// unified container __clone
$dao = $user->getEncapsulants();
$dao->setCriteria(Criteria::create()); // empty criteria
$cloneDao = clone $dao;
$cloneDao->setCriteria( // criteria with 1 expression
Criteria::create()
->add( Expression::gt('id',0) )
);
$this->assertNotEquals($dao, $cloneDao); // they should be different
}
}
?>