mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
em->flush($entity) for cascading associations behaves inconsistently between "inserts" and "updates" #6209
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TiMESPLiNTER on GitHub (Mar 27, 2019).
Originally assigned to: @Ocramius on GitHub.
Bug Report
Summary
The
flushmethod for associations behaves inconsistently between "inserts" and "updates" if you provide an entity as an argument.I have a
one-to-manyrelation withcascade=persist,remove. While the relations' entity gets inserted together with the main entity when I call...$em->flush($mainEntity)...the update case ignores changes for the relations' entity and does only persist the changes in the main entity.
Current behavior
Currently only create operations persist cascading relations' entities update operations don't.
How to reproduce
Create a relation:
Insert (works as expected):
The translation gets persisted together with the profile:
Update (works not as expected):
Only the changes for the profile entity get persisted the changes for the translation entity are ignored.
Expected behavior
I expect that both cases behave the same. Either both ignore sub entities if I only flush a specific parent entity or both do cascade and also store the relations' entity.
@SenseException commented on GitHub (Mar 27, 2019):
The argument in
flush()will be dropped and was already removed in master.The 2.7 branch still has the argument, but I see that it hasn't a deprecation yet. We probably need one there.
@Ocramius commented on GitHub (Mar 27, 2019):
I'm gonna close as
won't fixthis one for now though:flush($entity)will not be worked on.