public function parse(Request $request, Parameters $configuration, Context $context, $data) { $cacheKey = $configuration->get(Parameters::ACTION_ID); $lastModified = $configuration->get(Parameters::ACTION_LAST_MODIFIED); $this->loader->set($data, $cacheKey, $lastModified); $this->twig->getFilter(Prepare::FILTER_NAME)->getCallable()->clear(); $this->twig->getFilter(RowExists::FILTER_NAME)->getCallable()->setConnection($context->getConnection()); try { return $this->twig->render($configuration->get(Parameters::ACTION_ID), ['request' => $request, 'context' => $context, 'body' => new Accessor(new Validate(), $request->getBody())]); } catch (\Twig_Error_Runtime $e) { // if we have an display exception throw the original exception if ($e->getPrevious() instanceof DisplayException) { throw $e->getPrevious(); } else { throw $e; } } }