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