Skip to content
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:

  1. patch_manager.pre event fired
  2. patch_manager.pre.upgrade event fired
  3. patch operation
  4. patch_manager.post event fired
  5. 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

Next (Implement your own handler) ►