class RouteProviderLazyBuilder implements PreloadableRouteProviderInterface, PagedRouteProviderInterface, EventSubscriberInterface (View source)

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

Properties

protected RouteProviderInterface $routeProvider

The route provider service.

protected RouteBuilderInterface $routeBuilder

The route building service.

protected bool $rebuilt

Flag to determine if the router has been rebuilt.

protected bool $rebuilding

Flag to determine if router is currently being rebuilt.

Methods

__construct(RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder)

RouteProviderLazyBuilder constructor.

getRouteProvider()

Gets the real route provider service and rebuilds the router id necessary.

getRouteCollectionForRequest(Request $request)

{@inheritdoc}

getRouteByName($name)

{@inheritdoc}

preLoadRoutes(string[] $names)

Pre-load routes by their names using the provided list of names.

getRoutesByNames($names)

{@inheritdoc}

RouteCollection
getRoutesByPattern(string $pattern)

Get all routes which match a certain pattern.

Route[]
getAllRoutes()

Returns all the routes on the system.

reset()

Resets the route provider object.

getRoutesPaged($offset, $length = NULL)

{@inheritdoc}

getRoutesCount()

{@inheritdoc}

bool
hasRebuilt()

Determines if the router has been rebuilt.

static 
getSubscribedEvents()

{@inheritdoc}

routerRebuilding()

Sets the router rebuilding flag to TRUE.

routerRebuildFinished()

Sets the router rebuilding flag to FALSE.

Details

__construct(RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder)

RouteProviderLazyBuilder constructor.

Parameters

RouteProviderInterface $route_provider

The route provider service.

RouteBuilderInterface $route_builder

The route building service.

protected RouteProviderInterface getRouteProvider()

Gets the real route provider service and rebuilds the router id necessary.

Return Value

RouteProviderInterface

The route provider service.

getRouteCollectionForRequest(Request $request)

{@inheritdoc}

Parameters

Request $request

getRouteByName($name)

{@inheritdoc}

Parameters

$name

preLoadRoutes(string[] $names)

Pre-load routes by their names using the provided list of names.

This method exists in order to allow performance optimizations. It allows pre-loading serialized routes that may latter be retrieved using ::getRoutesByName()

Parameters

string[] $names

Array of route names to load.

getRoutesByNames($names)

{@inheritdoc}

Parameters

$names

RouteCollection getRoutesByPattern(string $pattern)

Get all routes which match a certain pattern.

Parameters

string $pattern

The route pattern to search for (contains } as placeholders).

Return Value

RouteCollection

Returns a route collection of matching routes. The collection may be empty and will be sorted from highest to lowest fit (match of path parts) and then in ascending order by route name for routes with the same fit.

Route[] getAllRoutes()

Returns all the routes on the system.

Usage of this method is discouraged for performance reasons. If possible, use RouteProviderInterface::getRoutesByNames() or RouteProviderInterface::getRoutesByPattern() instead.

Return Value

Route[]

An iterator of routes keyed by route name.

reset()

Resets the route provider object.

getRoutesPaged($offset, $length = NULL)

{@inheritdoc}

Parameters

$offset
$length

getRoutesCount()

{@inheritdoc}

bool hasRebuilt()

Determines if the router has been rebuilt.

Return Value

bool

TRUE is the router has been rebuilt, FALSE if not.

static getSubscribedEvents()

{@inheritdoc}

routerRebuilding()

Sets the router rebuilding flag to TRUE.

routerRebuildFinished()

Sets the router rebuilding flag to FALSE.