DAL - Add option during update / upsert that removes all non provided relation entities, e.g. product visibility (similar to doctrine's orphan removal) #3149
Closed
AndreasA
started this conversation in
RFC / Proposal
Replies: 3 comments
-
might be related to #3125 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey @AndreasA, i just implemented something like this during the last Hockethon of the Kellerkinder. It is also already merged: It's not exactly what you requested, but it goes in the same direction. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey, I have closed the discussion because with this proposal and the linked commit a similar behavior can be realized. I hope this is okay for you |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Effort: middle (probably)
Description:
I had the requirement quite often to update entities (upsert or update) with relations, where if the related entity was not provided, it should bedeleted, so e.g. one can easily create new relations and remove unused ones (and maybe update related entities if necessary).
Should probably only be done for associations where an
array
is provided, if nothing exists then no update should happen. And it should be optional and not enabled by default.This would be similar to doctrine's orphan removal.
It would also be helpful when e.g. updating a sales channel through code and adjusting its assigned language list, provided language relations are kept or created and others are removed. Especially as due to the requirement for keeping the system language relation, it isn't just possible to delete all relations and then add new ones.
Benefits
see description.
Break strategy
As it is an optional setting, it wouldn't break anything as long as it isn't used. Either by adding an optional parameter to the methods (which as iti s optional doesn't provide an issue on overrides) or by adding an additional state to the context object.
Beta Was this translation helpful? Give feedback.
All reactions