I have implemented a onKernelRequest handler:
class RequestSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents ()
{
return array (
KernelEvents::REQUEST => [array ('onKernelRequest', 5000)]
);
}
public function onKernelRequest (GetResponseEvent $event)
{
$request = $event->getRequest();
$request->attributes->set('_controller', 'TestBundle:Display:index');
}
}
For the sake of brevity I removed the conditional testing that goes into checking whether the controller should be overridden.
This works - except that the debug toolbar doesn't show now - and I assume all the other listeners/subscribers to this and kernel.controller are circumvented now as well???
Will this work better if I did it kernel.controller event instead? As the last handler with a higher priority?