-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multiple listeners being attached to models (#192)
Fixes wintercms/winter#1251 by replacing all instances of bindEvent inside a Laravel Model Event by bindEventOnce. There remains an edge case if the event gets cancelled by another listener with a higher priority. > Using bindEventOnce would fix this issue in most cases, but there's one I can think of where it would fail: if someone registers a handler for model.afterSave with more priority than the default, and this handler sometimes returns false. > In this case, let's imagine we save the model a first time: we bind the afterSave() method once; we fire the event; it gets cancelled by the other handler; so we don't call the afterSave() method. > Then we save a second time: we bind afterSave() again (we now have 2); we fire the event; for some reason the other handler does not return false; we call afterSave() twice.
- Loading branch information
Showing
4 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters