Generates a URL from the given parameters.
If the generator is not able to generate the url, it must throw the RouteNotFoundException as documented below.
@api
string $name The name of the route:
mixed $parameters An array of parameters:
Boolean $absolute Whether to generate an absolute URL:
string The generated URL
RouteNotFoundException if route doesn't exist
Overrides UrlGeneratorInterface::generate
public function generate($name, $parameters = array(), $absolute = false) {
if (null === ($route = $this->routes
->get($name))) {
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
}
// the Route has a cache of its own and is not recompiled as long as it does not get modified
$compiledRoute = $route
->compile();
return $this
->doGenerate($compiledRoute
->getVariables(), $route
->getDefaults(), $route
->getRequirements(), $compiledRoute
->getTokens(), $parameters, $name, $absolute);
}