function RouteProvider::getRoutesCount

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::getRoutesCount()
  2. 8.9.x core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::getRoutesCount()

Gets the total count of routes provided by the router.

Return value

int Number of routes.

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 480

Class

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

Namespace

Drupal\Core\Routing

Code

public function getRoutesCount() {
    @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);
    return $this->connection
        ->query("SELECT COUNT(*) FROM {" . $this->connection
        ->escapeTable($this->tableName) . "}")
        ->fetchField();
}

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