public function ContentAwareGenerator::generate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony-cmf/routing/ContentAwareGenerator.php \Symfony\Cmf\Component\Routing\ContentAwareGenerator::generate()
Parameters
string $name ignored.:
array $parameters must either contain the field 'route' with a: RouteObjectInterface or the field 'content_id' with the id of a document implementing RouteReferrersReadInterface.
Throws
RouteNotFoundException If there is no such route in the database
Overrides ProviderBasedGenerator::generate
File
- vendor/
symfony-cmf/ routing/ ContentAwareGenerator.php, line 68
Class
- ContentAwareGenerator
- A generator that tries to generate routes from object, route names or content objects or names.
Namespace
Symfony\Cmf\Component\RoutingCode
public function generate($name, $parameters = array(), $absolute = false) {
if ($name instanceof SymfonyRoute) {
$route = $this
->getBestLocaleRoute($name, $parameters);
}
elseif (is_string($name) && $name) {
$route = $this
->getRouteByName($name, $parameters);
}
else {
$route = $this
->getRouteByContent($name, $parameters);
}
if (!$route instanceof SymfonyRoute) {
$hint = is_object($route) ? get_class($route) : gettype($route);
throw new RouteNotFoundException('Route of this document is not an instance of Symfony\\Component\\Routing\\Route but: ' . $hint);
}
$this
->unsetLocaleIfNotNeeded($route, $parameters);
return parent::generate($route, $parameters, $absolute);
}