[2.0][DDC-211] Fixed collection diff calculation.
This commit is contained in:
parent
e6a10d36d9
commit
cced2bd6c3
@ -275,7 +275,8 @@ final class PersistentCollection implements \Doctrine\Common\Collections\Collect
|
||||
*/
|
||||
public function getDeleteDiff()
|
||||
{
|
||||
return array_udiff($this->_snapshot, $this->_coll->toArray(), array($this, '_compareRecords'));
|
||||
return array_udiff_assoc($this->_snapshot, $this->_coll->toArray(),
|
||||
function($a, $b) {return $a === $b ? 0 : 1;});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -286,17 +287,8 @@ final class PersistentCollection implements \Doctrine\Common\Collections\Collect
|
||||
*/
|
||||
public function getInsertDiff()
|
||||
{
|
||||
return array_udiff($this->_coll->toArray(), $this->_snapshot, array($this, '_compareRecords'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two records. To be used on _snapshot diffs using array_udiff.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
private function _compareRecords($a, $b)
|
||||
{
|
||||
return $a === $b ? 0 : 1;
|
||||
return array_udiff_assoc($this->_coll->toArray(), $this->_snapshot,
|
||||
function($a, $b) {return $a === $b ? 0 : 1;});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user