You are here

public function RouteProvider::getRoutesPaged in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getRoutesPaged()

Returns a chunk of routes.

Should only be used in conjunction with an iterator.

Parameters

int $offset: The query offset.

int $length: The number of records.

Return value

\Symfony\Component\Routing\Route[] Routes keyed by the route name.

Deprecated

in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided.

See also

https://www.drupal.org/node/3151009

File

core/lib/Drupal/Core/Routing/RouteProvider.php, line 450

Class

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

Namespace

Drupal\Core\Routing

Code

public function getRoutesPaged($offset, $length = NULL) {
  @trigger_error(__METHOD__ . '() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3151009', E_USER_DEPRECATED);
  $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;
}