Skip to content

Commit

Permalink
Fix to-many collections left in dirty state after entities are remove…
Browse files Browse the repository at this point in the history
…d by the UoW

@see doctrine#10486

Co-authored-by: Matthias Pigulla <mp@webfactory.de>
  • Loading branch information
jacquesbh and mpdude committed Apr 4, 2023
1 parent 5f76874 commit 61bfa03
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Doctrine/ORM/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,6 @@ private function computeAssociationChanges(array $assoc, $value): void
return;
}

if ($value instanceof PersistentCollection && $value->isDirty()) {
$coid = spl_object_hash($value);

$this->collectionUpdates[$coid] = $value;
$this->visitedCollections[$coid] = $value;
}

// Look through the entities, and in any of their associations,
// for transient (new) entities, recursively. ("Persistence by reachability")
// Unwrap. Uninitialized collections will simply be empty.
Expand Down Expand Up @@ -960,6 +953,13 @@ private function computeAssociationChanges(array $assoc, $value): void
// during changeset calculation anyway, since they are in the identity map.
}
}

if ($value instanceof PersistentCollection && $value->isDirty()) {
$coid = spl_object_hash($value);

$this->collectionUpdates[$coid] = $value;
$this->visitedCollections[$coid] = $value;
}
}

/**
Expand Down

0 comments on commit 61bfa03

Please sign in to comment.