getRouteKey example

$context = new RequestContext();
    $context->fromRequest($request);
    $this->setContext($context);

    return $this->match($this->currentPath->getPath($request));
  }

  /** * {@inheritdoc} */
  protected function getAttributes(Route $route$name, array $attributes): array {
    if ($route instanceof RouteObjectInterface && is_string($route->getRouteKey())) {
      $name = $route->getRouteKey();
    }
    $attributes[RouteObjectInterface::ROUTE_NAME] = $name;
    $attributes[RouteObjectInterface::ROUTE_OBJECT] = $route;

    return $this->mergeDefaults($attributes$route->getDefaults());
  }

}
Home | Imprint | This part of the site doesn't use cookies.