/**
  * Display data with JMS serialization &
  * Output it with correct content-type with FOSRest.
  *
  * @param mixed        $data         The data to display.
  * @param integer|null $statusCode   The HTTP status code.
  * @param string       $fullMode     The group name for JMS full view.
  * @param string       $standardMode The group name for JMS std view.
  *
  * @return View
  */
 protected function restView($data, $statusCode = null, $fullMode = null, $standardMode = null)
 {
     // Merge serialization groups with default
     $groups = array($this->isAdmin() ? 'full' : 'standard');
     if ($this->isAdmin() && $fullMode) {
         $groups[] = $fullMode;
     } elseif (!$this->isAdmin() && $standardMode) {
         $groups[] = $standardMode;
     }
     $view = new View($data, $statusCode);
     $view->setContext((new Context())->setSerializeNull(true)->addGroups(array_merge(array('Default'), $groups)));
     return $view;
 }