-
Notifications
You must be signed in to change notification settings - Fork 2
Events
matteosister edited this page Dec 5, 2014
·
3 revisions
Next (Implement your own handler) ►
If you pass an instance of EventDispatcherInterface to the setEventDispatcherInterface() method you can start listen for events
Suppose that you have an operation named upgrade.
You patch a resource like this:
PATCH /users/1
{ "op": "upgrade" }
The lifecycle of the operation is:
- patch_manager.pre event fired
- patch_manager.pre.upgrade event fired
- patch operation
- patch_manager.post event fired
- patch_manager.post.upgrade event fired
This is true for every subject AND for every patch operation.
By now only the Symfony EventDispatcherInterface is supported.
So you can register your listener classes on these events and do more business logic not related to the patch operation itself. Some example could be:
- fire some kind of queue system (like rabbitmq) after changing a property that requires off-request work
- send a confirmation email after updating the user email
Use the table of contents to the top right to navigate to other wiki sections.