/**
* Sets the cache key on the alias manager cache decorator.
*
* KernelEvents::CONTROLLER is used in order to be executed after routing.
*
* @param \Symfony\Component\HttpKernel\Event\ControllerEvent $event
* The Event to process.
*/
public function onKernelController(ControllerEvent
$event) { // Set the cache key on the alias manager cache decorator.
if ($event->
isMainRequest()) { $this->aliasManager->
setCacheKey(rtrim($this->currentPath->
getPath($event->
getRequest()), '/'
));
} } /**
* Ensures system paths for the request get cached.
*/
public function onKernelTerminate(TerminateEvent
$event) { $this->aliasManager->
writeCache();
} /**
* Registers the methods in this class that should be listeners.
*
* @return array
* An array of event listener definitions.
*/