/**
  * {@inheritdoc}
  */
 public function resolveContextFromRequest(Request $request, ResourceInterface $resource)
 {
     $requestId = $request->headers->get(KernelEventListener::SUB_HEADER);
     if (array_key_exists($requestId, $this->contexts) === true) {
         return $this->contexts[$requestId];
     }
     $spec = $request->get('_rested');
     $requestParser = new RequestParser();
     $requestParser->parse($request->getRequestUri(), $request->query->all());
     $cache = $this->compilerCache;
     $cache->setAuthorizationChecker($this->authorizationChecker);
     $factory = $this->factory;
     $compiledResourceDefinition = $cache->findResourceDefinition($spec['route_name']);
     $context = $factory->createContext($requestParser->getParameters(), $spec['action'], $spec['route_name'], $compiledResourceDefinition);
     return $this->contexts[$requestId] = $context;
 }
 /**
  * {@inheritdoc}
  */
 public function resolveContextFromRequest(SymfonyRequest $request, ResourceInterface $resource)
 {
     $requestId = $request->headers->get(RequestIdMiddleware::SUB_HEADER);
     if (array_key_exists($requestId, $this->contexts) === true) {
         return $this->contexts[$requestId];
     }
     $spec = $request->get('_rested');
     $requestParser = new RequestParser();
     $requestParser->parse($request->getRequestUri(), $request->query->all());
     $cache = $this->app['rested.compiler_cache'];
     $cache->setAuthorizationChecker($this->app['security.authorization_checker']);
     $factory = $this->app['rested.factory'];
     $compiledResourceDefinition = $cache->findResourceDefinition($spec['route_name']);
     $context = $factory->createContext($requestParser->getParameters(), $spec['action'], $spec['route_name'], $compiledResourceDefinition);
     return $this->contexts[$requestId] = $context;
 }