Hari KT has a quick tutorial posted to his site showing you how to use custom events in Symfony bundles from start to finish.
In this tutorial we will create a custom event for symfony2 bundle. Assuming you have downloaded the symfony-standard distribution to play.
He starts by creating a simple bundle (HktEventBundle
) and building out the matching event class, extending the base Symfony EventDispatcherEvent
. He then shows how to dispatch a simple event from a controller, triggering a html.event.page_viewed
event when the request is made to this default controller. He matches this with a listener that subscribes to the event (including a handler method) and the changes you'll need to make to your configuration to wire them all together.