public function MongodbRouterRouteProvider::getRoutesByNames in MongoDB 8
Overrides RouteProvider::getRoutesByNames
File
- src/
MongodbRouterRouteProvider.php, line 54 - Contains Drupal\mongodb\MongodbRouterRouteProvider.
Class
- MongodbRouterRouteProvider
- A Route Provider front-end for all Drupal-stored routes.
Namespace
Drupal\mongodbCode
public function getRoutesByNames($names, $parameters = []) {
if (empty($names)) {
throw new \InvalidArgumentException('You must specify the route names to load');
}
$routes_to_load = array_values(array_diff($names, array_keys($this->routes)));
if ($routes_to_load) {
$routes = $this->mongo
->get($this->tableName)
->find(array(
'_id' => array(
'$in' => $routes_to_load,
),
));
foreach ($routes as $name => $route_array) {
$this->routes[$name] = $this
->getRouteFromArray($route_array);
}
}
return array_intersect_key($this->routes, array_flip($names));
}