-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add examples to showcase how to stop events #5106
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
Conversation
en/orm/table-objects.rst
Outdated
| stopping this event you will abort the delete operation. | ||
| stopping this event you will abort the delete operation. When the event is stopped the result | ||
| of the event will be returned. | ||
| Stopping the event works like this:: |
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.
Should we link to the relevant section in the events docs instead?
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.
That could be an option, too. It would be this link, right? https://book.cakephp.org/3.0/en/core-libraries/events.html#stopping-events
I hope it's obvious how to call it than 😀
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.
Yes, that looks like a good place to link to.
en/orm/table-objects.rst
Outdated
|
|
||
| public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options) | ||
| { | ||
| ... |
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.
// ...
Just for the lazyp people copying stuff 1:1 😆
en/orm/table-objects.rst
Outdated
| { | ||
| ... | ||
| $event->stopPropagation(); | ||
| ... |
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.
Same
I added an example on how to stop the event, as I saw/got that question a few times lately.