You are here

public function AccessAwareRouter::matchRequest in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Routing/AccessAwareRouter.php \Drupal\Core\Routing\AccessAwareRouter::matchRequest()

Throws

\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException Thrown when access checking failed.

Overrides AccessAwareRouterInterface::matchRequest

1 call to AccessAwareRouter::matchRequest()
AccessAwareRouter::match in core/lib/Drupal/Core/Routing/AccessAwareRouter.php

File

core/lib/Drupal/Core/Routing/AccessAwareRouter.php, line 91

Class

AccessAwareRouter
A router class for Drupal with access check and upcasting.

Namespace

Drupal\Core\Routing

Code

public function matchRequest(Request $request) {
  $parameters = $this->router
    ->matchRequest($request);
  $request->attributes
    ->add($parameters);
  $this
    ->checkAccess($request);

  // We can not return $parameters because the access check can change the
  // request attributes.
  return $request->attributes
    ->all();
}