/**
  * @param GetResponseEvent $event
  */
 public function onRequest(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     $parameters = $request->attributes->get('_route_params', []);
     foreach ($parameters as $name => $value) {
         $this->stack->set($name, $value);
     }
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
 {
     if (null !== ($route = $this->getRouteCollection()->get($name))) {
         $compiled = $route->compile();
         $variables = $compiled->getVariables();
         foreach ($variables as $key) {
             if (false === array_key_exists($key, $parameters)) {
                 $parameters[$key] = $this->parameters->get($key);
             }
         }
     }
     return $this->router->generate($name, $parameters, $referenceType);
 }