/**
  * View a single content page
  *
  * This Controller action is being routed to from either our custom ContentRouter,
  * or the ExceptionController.
  * @see Opifer\SiteBundle\Router\ContentRouter
  *
  * @param Request $request
  * @param Content $content
  *
  * @return Response
  */
 public function viewAction(Request $request, ContentInterface $content, $statusCode = 200)
 {
     $presentation = json_decode($content->getRealPresentation(), true);
     if (!$presentation) {
         throw new \Exception('The template ' . $content->getTemplate()->getName() . ' does not have a layout attached.');
     }
     $layout = json_encode($presentation);
     $layout = $this->get('jms_serializer')->deserialize($layout, $this->container->getParameter('opifer_content.layout_class'), 'json');
     // If the layout has an action, forward to that action and pass the layout
     // and the content.
     if ($layout->getAction()) {
         return $this->forward($layout->getAction(), ['content' => $content, 'layout' => $layout]);
     }
     $response = new Response();
     $response->setStatusCode($statusCode);
     return $this->render($layout->getFilename(), ['content' => $content, 'layout' => $layout], $response);
 }