Hi,
I'm trying to run some code before the route is executed, but cannot figure out how to register my function. In services.php:
$eventsManager = new EventsManager;
$di->setShared('eventsManager', $eventsManager);
$eventsManager->attach(
'dispatch:beforeExecuteRoute',
function (Event $event) use ($di) {
error_log(serialize($event->getType()));
}
);
but nothing happens, why?