Closed MartinHlavna closed 5 years ago
https://github.com/Jaguar-dart/jaguar_orm/pull/100 makes sure that not all records are removed if there are no associations to detach in pivot table.
Another issue remains that the other end of the many-to-many relation is removed even if there are some other relations left for it. Should it be handled?
If my proposed solution is OK, I can look at this.
I agree with your proposal. Only change I would like to propose is instead of orphanRemoval
on ManyToMany annotation, it would be nice to have it in generated remove method which shall be passed on to generated detach method.
Opened PR #106. Did some testing, looks like this works. I was hovewer suprised that remove takes optional positional arguments. It may be bee good in future to change this to named parameters, but that would be breaking change right now.
@MartinHlavna What if we don't remove the right side at all but just remove the entries from the pivot table.
Hello, sorry for the delay I had some personal issues that I had to solve and didn't have time for this. Removing only right side could be solution for most users. However there may be use cases where it is desired behaviour to remove right side. Most ORMs in other frameworks tends to support both use cases.
That would be also breaking change.
Hi,
I am planning to absorb your suggested changes.
Hello, i ran to the following use case
Proposed solution: