I would like to get a list with every listeners registered on my applicacion as well as their priority. That list should contain my own listeners and the listeners that Symfony core or other enabled bundles have registered as well.
Is that possible?
Thanks
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With