-
-
Notifications
You must be signed in to change notification settings - Fork 62
HasMany: removeAll #788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
HasMany: removeAll #788
Conversation
607cd60 to
cd07a7d
Compare
tests/cases/integration/Relationships/relationships.oneHasMany.removeAll.phpt
Show resolved
Hide resolved
Closes nextras#276.
cd07a7d to
f6a8cb9
Compare
| START TRANSACTION; | ||
| COMMIT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no DELETE. Do you know why? @hrach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-O I do not. Hopefully, you have not discovered a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks buggy to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, this is a real bug that has been hidden for many years.
Expected behavior:
- throw an exception, that (in this case) the TagFollowe::$author cannot be null, or
- delete the TagFollower if and only if the relationship is marked with a correct, currently non-existing, cascade marker, e.g.,
removeOrphan.
The second option is tracked in #205 and #278. Sadly, the current behavior does not rigger exception (either missing unsupported removeOrphan || non-nullable).
Supporting removeOrphan is a bit more difficult - we need to rewrite PersistenceHelper & RemovalHelper -> join the implementation together -> since the wanted behavior is in RemovalHelper, but needs to be triggered from PersistenceHelper.
As we are in the 5.1 RC phase, I would rather incline to trigger the exception. The working workaround is to call the TagFollower repository's remove().
Closes #276.