Пример #1
0
 /**
  * Initializes the view before invoking an action method.
  *
  * Override this method to solve assign variables common for all actions
  * or prepare the view in another way before the action is called.
  *
  * @param ViewInterface $view The view to be initialized
  * @return void
  * @api
  */
 protected function initializeView(ViewInterface $view)
 {
     parent::initializeView($view);
     if (!is_null($this->view) && $this->view instanceof JsonView && $this->request->getFormat() === 'json') {
         $this->view->setOption('contentTypeHeader', current($this->supportedMediaTypes));
     }
 }