Find many routes by their names using the provided list of names.
Note that this method may not throw an exception if some of the routes are not found. It will just return the list of those routes it found.
This method exists in order to allow performance optimizations. The simple implementation could be to just repeatedly call $this->getRouteByName().
array $names: The list of names to retrieve.
array $parameters: The parameters as they are passed to the UrlGeneratorInterface::generate call. (Only one array, not one for each entry in $names).
\Symfony\Component\Routing\Route[] Iterable thing with the keys the names of the $names argument.
Overrides RouteProviderInterface::getRoutesByNames
public function getRoutesByNames($names, $parameters = array()) {
if (empty($names)) {
throw new \InvalidArgumentException('You must specify the route names to load');
}
$routes_to_load = array_diff($names, array_keys($this->routes));
if ($routes_to_load) {
$result = $this->connection
->query('SELECT name, route FROM {' . $this->connection
->escapeTable($this->tableName) . '} WHERE name IN (:names)', array(
':names' => $routes_to_load,
));
$routes = $result
->fetchAllKeyed();
$return = array();
foreach ($routes as $name => $route) {
$this->routes[$name] = unserialize($route);
}
}
return array_intersect_key($this->routes, array_flip($names));
}