O'Reilly logo

CakePHP 2 Application Cookbook by Jorge González, James Watts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing event priorities

When a new event is dispatched in CakePHP, all the listeners which match the event name that are attached to the event manager where the event was dispatched will be triggered to process the event in order. Sometimes, we need to ensure that a specific order is followed when several listeners are triggered for a specific event. This can be done through the event manager API. We also have the ability to stop the event propagation and force the rest of the listeners to be ignored after the current listener finishes.

In this recipe, we look at how you can control the event dispatch process to keep your events executing accordingly.

Getting ready

We'll continue to use our packages table for this recipe. If you don't have it, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required