Neos\Flow\Mvc\Controller\ControllerContext::getResponse PHP Méthode

getResponse() public méthode

Get the response of the controller
public getResponse ( ) : Neos\Flow\Mvc\ResponseInterface
Résultat Neos\Flow\Mvc\ResponseInterface
    public function getResponse()
    {
        return $this->response;
    }

Usage Example

 /**
  * Transforms the value view variable to a serializable
  * array represantion using a YAML view configuration and JSON encodes
  * the result.
  *
  * @return string The JSON encoded variables
  * @api
  */
 public function render()
 {
     $this->controllerContext->getResponse()->setHeader('Content-Type', 'application/json');
     $propertiesToRender = $this->renderArray();
     $options = $this->getOption('jsonEncodingOptions');
     return json_encode($propertiesToRender, $options);
 }