public function RouteProvider::getRouteCollectionForRequest in Drupal 9
Same name in this branch
- 9 core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::getRouteCollectionForRequest()
- 9 core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getRouteCollectionForRequest()
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::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
Overrides RouteProviderInterface::getRouteCollectionForRequest
File
- core/
tests/ Drupal/ KernelTests/ RouteProvider.php, line 34
Class
- RouteProvider
- Rebuilds the router when the provider is instantiated.
Namespace
Drupal\KernelTestsCode
public function getRouteCollectionForRequest(Request $request) {
return $this
->lazyLoadItself()
->getRouteCollectionForRequest($request);
}