public function RouteProviderLazyBuilder::getRouteCollectionForRequest

public RouteProviderLazyBuilder::getRouteCollectionForRequest(Request $request)

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

Request $request A request against which to match.:

Return value

RouteCollection with all Routes that could potentially match $request. Empty collection if nothing can match.

Overrides RouteProviderInterface::getRouteCollectionForRequest

File

core/lib/Drupal/Core/Routing/RouteProviderLazyBuilder.php, line 64

Class

RouteProviderLazyBuilder
A Route Provider front-end for all Drupal-stored routes.

Namespace

Drupal\Core\Routing

Code

public function getRouteCollectionForRequest(Request $request) {
  return $this->getRouteProvider()->getRouteCollectionForRequest($request);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!RouteProviderLazyBuilder.php/function/RouteProviderLazyBuilder::getRouteCollectionForRequest/8.1.x