/** * Return an array of serialized simple relationships. * * @return array */ public function fetchSimple() { $resources = array(); foreach ($this->transformer->getRelationships() as $key => $resource) { $resources[$key] = $this->serializer->simple($resource, $key); } return $resources; }
/** * @inheritdoc */ public function item(array $data, TransformerAbstract $transformer) { $resource = array('id' => $data['id'], 'type' => $transformer->getTypeKey(), 'attributes' => $data); unset($resource['attributes']['id']); foreach (array_keys($transformer->getRelationships()) as $relationship) { unset($resource['attributes'][$relationship]); } return $resource; }