public function RouteProvider::getRoutesPaged in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getRoutesPaged()
Find an amount of routes with an offset and possible a limit.
In case you want to iterate over all routes, you want to avoid to load all routes at once.
Parameters
int $offset: The sequence will start with that offset in the list of all routes.
int $length [optional]: The sequence will have that many routes in it. If no length is specified all routes are returned.
Return value
\Symfony\Component\Routing\Route[] Routes keyed by the route name.
Overrides PagedRouteProviderInterface::getRoutesPaged
File
- core/
lib/ Drupal/ Core/ Routing/ RouteProvider.php, line 394 - Contains \Drupal\Core\Routing\RouteProvider.
Class
- RouteProvider
- A Route Provider front-end for all Drupal-stored routes.
Namespace
Drupal\Core\RoutingCode
public function getRoutesPaged($offset, $length = NULL) {
$select = $this->connection
->select($this->tableName, 'router')
->fields('router', [
'name',
'route',
]);
if (isset($length)) {
$select
->range($offset, $length);
}
$routes = $select
->execute()
->fetchAllKeyed();
$result = [];
foreach ($routes as $name => $route) {
$result[$name] = unserialize($route);
}
return $result;
}