/** * Serializes the response data in xml format. * * @param array $data * The data to serialize * * @return \Symfony\Component\HttpFoundation\Response * The response for chaining. */ protected function serializeResponseData($data, $code = Response::HTTP_OK) { $output = $this->serializer->serialize($data, 'xml'); $response = new Response($output, $code); $response->headers->set('Content-Type', 'application/xml; charset=utf-8'); return $response; }
/** * Get an array of built relationships. * * @return Relationship[] */ protected function buildRelationships() { $paths = Util::parseRelationshipPaths($this->includes); $relationships = []; foreach ($paths as $name => $nested) { $relationship = $this->serializer->getRelationship($this->data, $name); if ($relationship) { $relationship->getData()->with($nested)->fields($this->fields); $relationships[$name] = $relationship; } } return $relationships; }
/** * @param SerializerInterface $serializer */ public function addSerializer(SerializerInterface $serializer) { $dataSourceName = $serializer->getDataSourceName(); $this->serializers[$dataSourceName] = $serializer; }