Wrong behaviour of flush($entity) ? #5179

Closed
opened 2026-01-22 15:00:51 +01:00 by admin · 1 comment
Owner

Originally created by @danionut90 on GitHub (Jul 7, 2016).

Originally assigned to: @Ocramius on GitHub.

both $entityA and $entityB have changes

$em->computeChangeSet($entityA);

$em->flush($entityB); -> the changes from $entityB and also $entityA will be saved to db.

Is this normal ?

Originally created by @danionut90 on GitHub (Jul 7, 2016). Originally assigned to: @Ocramius on GitHub. both $entityA and $entityB have changes $em->computeChangeSet($entityA); $em->flush($entityB); -> the changes from $entityB and also $entityA will be saved to db. Is this normal ?
admin added the BugInvalid labels 2026-01-22 15:00:51 +01:00
admin closed this issue 2026-01-22 15:00:52 +01:00
Author
Owner

@Ocramius commented on GitHub (Jul 7, 2016):

flush($entity) does not mean that $entity will be the only change to be committed. It is a performance optimization that forces the entity manager to only compute changes on the given $entity, but previous computed changes will still apply.

@Ocramius commented on GitHub (Jul 7, 2016): `flush($entity)` does not mean that `$entity` will be the only change to be committed. It is a performance optimization that forces the entity manager to only compute changes on the given `$entity`, but previous computed changes will still apply.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5179