Commit ba496fd3 authored by romanb's avatar romanb

[2.0][DDC-158] Small correction to previous patch. Moved takeSnapshot up in...

[2.0][DDC-158] Small correction to previous patch. Moved takeSnapshot up in order not lose new objects that were added before initialization.
parent 61f09e33
......@@ -235,13 +235,13 @@ final class PersistentCollection implements \Doctrine\Common\Collections\Collect
}
$this->_coll->clear();
$this->_association->load($this->_owner, $this, $this->_em);
$this->takeSnapshot();
// Reattach NEW objects added through add(), if any.
if (isset($newObjects)) {
foreach ($newObjects as $obj) {
$this->_coll->add($obj);
}
}
$this->takeSnapshot();
$this->_initialized = true;
}
}
......@@ -435,6 +435,8 @@ final class PersistentCollection implements \Doctrine\Common\Collections\Collect
// SQL "SELECT 1" on the association (table) without initializing
// the collection.
// TODO: Change to use PK identity, not php object identity!?
$this->_initialize();
return $this->_coll->contains($element);
}
......
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