function RouteProviderInterface::getRouteCollectionForRequest

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/RouteProviderInterface.php \Drupal\Core\Routing\RouteProviderInterface::getRouteCollectionForRequest()
  2. 10 core/lib/Drupal/Core/Routing/RouteProviderInterface.php \Drupal\Core\Routing\RouteProviderInterface::getRouteCollectionForRequest()

Finds routes that may potentially match the request.

This may return a mixed list of class instances, but all routes returned must extend the core Symfony route. The classes may also implement RouteObjectInterface to link to a content document.

This method may not throw an exception based on implementation specific restrictions on the URL. That case is considered a not found - returning an empty array. Exceptions are only used to abort the whole request in case something is seriously broken, like the storage backend being down.

Note that implementations may not implement an optimal matching algorithm, simply a reasonable first pass. That allows for potentially very large route sets to be filtered down to likely candidates, which may then be filtered in memory more completely.

Parameters

\Symfony\Component\HttpFoundation\Request $request: A request against which to match

Return value

\Symfony\Component\Routing\RouteCollection All Routes that could potentially match $request. Empty collection if nothing can match

4 methods override RouteProviderInterface::getRouteCollectionForRequest()
MockRouteProvider::getRouteCollectionForRequest in core/modules/system/src/Tests/Routing/MockRouteProvider.php
Implements \Drupal\Core\Routing\RouteProviderInterface::getRouteCollectionForRequest().
RouteProvider::getRouteCollectionForRequest in core/tests/Drupal/KernelTests/RouteProvider.php
Finds routes that may potentially match the request.
RouteProvider::getRouteCollectionForRequest in core/lib/Drupal/Core/Routing/RouteProvider.php
Finds routes that may potentially match the request.
RouteProviderLazyBuilder::getRouteCollectionForRequest in core/lib/Drupal/Core/Routing/RouteProviderLazyBuilder.php
Finds routes that may potentially match the request.

File

core/lib/Drupal/Core/Routing/RouteProviderInterface.php, line 36

Class

RouteProviderInterface
Defines the route provider interface.

Namespace

Drupal\Core\Routing

Code

public function getRouteCollectionForRequest(Request $request);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.