/** * Renders the view. * * This is done by applying all normalizers assigned to this view to the * assigned values. This is done recursively, so you can serialize arbitrarily * deeply nested object structures. * * @return string */ public function render() { $response = $this->controllerContext->getResponse(); if ($response instanceof HttpResponse) { $response->setHeader('Content-Type', $this->serializer->getMimeType()); } $data = $this->getDataToRender(); $data = $this->recursiveNormalizer->normalize($data, $this->normalizers); return $this->serializer->serialize($data); }
/** * Gets the IANA media typt of the serialized format. * * @return string */ public function getMimeType() { return $this->serializer->getMimeType(); }