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.
*/
public static function getSubscribedEvents(): array
{ $events[KernelEvents::CONTROLLER
][] =
['onKernelController', 200
];
$events[KernelEvents::TERMINATE
][] =
['onKernelTerminate', 200
];