From 126bb1903f1c546a15ca37a10e223e08779a6fd7 Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Sat, 22 Sep 2012 13:21:10 -0500 Subject: [PATCH] Remove no-longer-needed RouterListener subclass. We can use the Symfony one directly now. --- .../Core/EventSubscriber/RouterListener.php | 96 ------------------- 1 file changed, 96 deletions(-) delete mode 100644 core/lib/Drupal/Core/EventSubscriber/RouterListener.php diff --git a/core/lib/Drupal/Core/EventSubscriber/RouterListener.php b/core/lib/Drupal/Core/EventSubscriber/RouterListener.php deleted file mode 100644 index 7b158fdf5f6..00000000000 --- a/core/lib/Drupal/Core/EventSubscriber/RouterListener.php +++ /dev/null @@ -1,96 +0,0 @@ -urlMatcher = $urlMatcher; - $this->logger = $logger; - } - - /** - * {@inheritdoc} - * - * This method is nearly identical to the parent, except it passes the - * $request->attributes->get('system_path') variable to the matcher. - * That is where Drupal stores its processed, de-aliased, and sanitized - * internal path. We also pass the full request object to the URL Matcher, - * since we want attributes to be available to the matcher and to controllers. - */ - public function onKernelRequest(GetResponseEvent $event) { - $request = $event->getRequest(); - - if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->urlMatcher->getContext()->fromRequest($request); - $this->urlMatcher->setRequest($request); - } - - if ($request->attributes->has('_controller')) { - // Routing is already done. - return; - } - - // Add attributes based on the path info (routing). - try { - $parameters = $this->urlMatcher->match($request->attributes->get('system_path')); - - if (null !== $this->logger) { - $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters))); - } - - $request->attributes->add($parameters); - unset($parameters['_route']); - unset($parameters['_controller']); - $request->attributes->set('_route_params', $parameters); - } - catch (ResourceNotFoundException $e) { - $message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo()); - - throw new NotFoundHttpException($message, $e); - } - catch (MethodNotAllowedException $e) { - $message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), strtoupper(implode(', ', $e->getAllowedMethods()))); - - throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e); - } - } -}