Commit cced2bd6 authored by romanb's avatar romanb

[2.0][DDC-211] Fixed collection diff calculation.

parent e6a10d36
......@@ -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;});
}
/**
......
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