-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
PivotModel's beforeDelete not working #2747
Comments
@LukeTowers I put a break point on this line: https://github.com/octobercms/library/blob/master/src/Database/Pivot.php#L88 And realized that when I remove a friend, the |
Check the belongsToMany relationship trait, specifically the |
@LukeTowers @daftspunk I traced the code and this is what I've figured out so far: When I add a new friend relationship, the following functions are called in order:
Therefor, the But for removing a friend relationship, the following sequence happens:
And that's all! No event is fired and therefor the |
Thanks @meysam, that’s very helpful! If you would like to take a stab at a PR that would fix the issue, then I would welcome it very much. Otherwise we’ll take a look at fixing this when we’ve got some time. The support demand for October is increasing, while the available time the founders have to give remains the same. These issues will be handled in time, however there are ways you can help:
|
Yes, unfortunately the events exist only at the model level, not at the 1-tier lower query level. So when There could be some ways around this
Either way a test case should be created for this so the fix can be implemented and proven to be resolved. Please submit a Pull Request to the test plugin for investigation that demonstrates the issue. Don't forget to include step by step instructions how how to replicate it using the test plugin. |
One other thing, try to avoid referencing slack in issues: not everyone has access, and only 10,000 messages are kept on slack. Eventually the OP reference will be destroyed. |
Closing as it has been over a month since any activity on this occurred. |
@daftspunk @LukeTowers |
@LukeTowers @daftspunk Any idea how the pivot model can be accessed in |
@meysammahfouzi you should just able to call |
@LukeTowers calling |
@meysammahfouzi what do you mean by "apparently"? |
@LukeTowers I mean if I am not doing it wrong! Because when I log |
@meysammahfouzi try |
This commit tries to fix octobercms#2747
Closing as it has been over a month since any activity on this occurred and we are trying to figure out what issues are still relevant. If this is still something that you would like to see through to fruition please respond and we can get the ball rolling. |
Expected behavior
beforeDelete
should be called for PivotModel when a pivot record is deleted from database.Actual behavior
beforeDelete
is not called for PivotModel when a pivot record is deleted from database.Reproduce steps
The problem has been described here in detail: http://stackoverflow.com/q/42740344/69537
And also discussed here: https://octobercms.slack.com/archives/general/p1489352096625225
October build
393
The text was updated successfully, but these errors were encountered: