function RouteCollection::addAlias
Sets an alias for an existing route.
Parameters
string $name The alias to create:
string $alias The route to alias:
Throws
InvalidArgumentException if the alias is for itself
File
-
vendor/
symfony/ routing/ RouteCollection.php, line 360
Class
- RouteCollection
- A RouteCollection represents a set of Route instances.
Namespace
Symfony\Component\RoutingCode
public function addAlias(string $name, string $alias) : Alias {
if ($name === $alias) {
throw new InvalidArgumentException(\sprintf('Route alias "%s" can not reference itself.', $name));
}
unset($this->routes[$name], $this->priorities[$name]);
return $this->aliases[$name] = new Alias($alias);
}