Getting a list with every listeners on Symfony2 Getting a list with every listeners on Symfony2 symfony symfony

Getting a list with every listeners on Symfony2


If you don't want to write code to display it on your website you can just use CLI:

php app/console debug:event-dispatcher


You can get event dispatcher from container and take a look at events with getListeners function. Example in controller

$evd = $this->get('event_dispatcher');$listeners = $evd->getListeners();

Description

/** * Gets the listeners of a specific event or all listeners. * * @param string $eventName The name of the event * * @return array The event listeners for the specified event, or all event listeners by event name */public function getListeners($eventName = null);

Be careful, doctrine has own event dispatcher.

/** @var $em EntityManager */$em = $this->getDoctrine()->getManager();$evd = $em->getEventManager();$listeners = $evd->getListeners();