Skip to content

Commit

Permalink
Merge pull request #1452 from dpfaffenbauer/issue/1437
Browse files Browse the repository at this point in the history
[EntityMerger] reset state of newData
  • Loading branch information
dpfaffenbauer authored Jul 24, 2020
2 parents 66ab468 + 9fd6022 commit 710b8c0
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ private function checkAssociations($entity, $managedCopy, array &$visited)
if ($assoc['type'] === ClassMetadata::MANY_TO_MANY) {
$newCollection = $origData;

//Reset new Data, for some reason the line above resets newData
$newData = $class->reflFields[$assoc['fieldName']]->getValue($entity);

$this->mergeCollection($origData, $newData, $assoc, static function ($foundEntry) use ($newCollection) {
$newCollection->removeElement($foundEntry);
}, $visited);
Expand Down

0 comments on commit 710b8c0

Please sign in to comment.