[2.0][DDC-158] Small correction to previous patch. Moved takeSnapshot up in order not lose new objects that were added before initialization.
This commit is contained in:
parent
61f09e335e
commit
ba496fd3ad
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user