Skip to content

Loading…

DDC-678: OneToMany/OneToOne + onDelete=CASCADE may corrupt UoW. #5188

Open
doctrinebot opened this Issue · 3 comments

1 participant

@doctrinebot

Jira issue originally created by user romanb:

OneToMany/OneToOne associations together with an onDelete=CASCADE schema generation hint on the @JoinColumn and appropriate foreign key constraints can potentially result in a corrupt UoW if the associated objects are already managed. We need to add tests for such scenarios and settle on a well-defined behavior in such cases.

@doctrinebot

Comment created by @beberlei:

I think to preserve the semantics the following has to happen:

"on-delete" => "cascade" has to implicitly set cascade = remove. This hurts performance of course vs just using the on-delete, however it won't corrupt the UoW.

@doctrinebot

Comment created by @beberlei:

Not entirely would it hurt performance, you could check if on-delete => cascade is set. If this is the case you wouldnt need to do an explicit remove using the UnitOfWorks cascade.

@doctrinebot

Comment created by @beberlei:

Changed to improvement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.