Convert LegacyUrlMatcher to use RequestMatcherInterface rather than UrlMatcherInterface.

8.0.x
Larry Garfield 2012-08-11 15:25:48 -05:00 committed by effulgentsia
parent 41586439a4
commit 1bf98066ba
2 changed files with 6 additions and 5 deletions

View File

@ -59,7 +59,7 @@ class CoreBundle extends Bundle
$dispatcher = $container->get('dispatcher'); $dispatcher = $container->get('dispatcher');
$matcher = new \Drupal\Core\LegacyUrlMatcher(); $matcher = new \Drupal\Core\LegacyUrlMatcher();
$content_negotation = new \Drupal\Core\ContentNegotiation(); $content_negotation = new \Drupal\Core\ContentNegotiation();
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\RouterListener($matcher)); $dispatcher->addSubscriber(new \Symfony\Component\HttpKernel\EventListener\RouterListener($matcher));
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\ViewSubscriber($content_negotation)); $dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\ViewSubscriber($content_negotation));
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\AccessSubscriber()); $dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\AccessSubscriber());
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber()); $dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber());

View File

@ -9,13 +9,14 @@ namespace Drupal\Core;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\RequestContextAwareInterface;
use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RequestContext;
/** /**
* UrlMatcher matches URL based on a set of routes. * UrlMatcher matches URL based on a set of routes.
*/ */
class LegacyUrlMatcher implements UrlMatcherInterface { class LegacyUrlMatcher implements RequestMatcherInterface, RequestContextAwareInterface {
/** /**
* The request context for this matcher. * The request context for this matcher.
@ -98,8 +99,8 @@ class LegacyUrlMatcher implements UrlMatcherInterface {
* *
* @api * @api
*/ */
public function match($pathinfo) { public function matchRequest(Request $request) {
if ($router_item = $this->matchDrupalItem($pathinfo)) { if ($router_item = $this->matchDrupalItem($request->attributes->get('system_path'))) {
$ret = $this->convertDrupalItem($router_item); $ret = $this->convertDrupalItem($router_item);
// Stash the router item in the attributes while we're transitioning. // Stash the router item in the attributes while we're transitioning.
$ret['drupal_menu_item'] = $router_item; $ret['drupal_menu_item'] = $router_item;