function RouteProvider::getAllRoutes

Same name in this branch
  1. 9 core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::getAllRoutes()
Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::getAllRoutes()
  2. 8.9.x core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getAllRoutes()
  3. 10 core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::getAllRoutes()
  4. 10 core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getAllRoutes()
  5. 11.x core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::getAllRoutes()
  6. 11.x core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getAllRoutes()

Overrides RouteProviderInterface::getAllRoutes

File

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

Class

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

Namespace

Drupal\Core\Routing

Code

public function getAllRoutes() {
    $select = $this->connection
        ->select($this->tableName, 'router')
        ->fields('router', [
        'name',
        'route',
    ]);
    $routes = $select->execute()
        ->fetchAllKeyed();
    $result = [];
    foreach ($routes as $name => $route) {
        $result[$name] = unserialize($route);
    }
    $array_object = new \ArrayObject($result);
    return $array_object->getIterator();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.