/** * @param $data * * @return SerializableResourceInterface */ public function normalize($data) : SerializableResourceInterface { $resource = new Resource(); $resource->setName($data['name']); $resource->setProperties($data['props']); return $resource; }
/** * @param ClassMetadata $metaData * @param $entity * * @return ResourceInterface|Resource * @throws Exception */ protected function createResource(ClassMetadata $metaData, $entity) : Resource { $resource = new Resource(); if (!empty($this->getBaseUri())) { $resource->setBaseUri($this->getBaseUri() . strtolower($resource->getName()) . '/'); } $resource->setClass(get_class($entity)); $resource->setName(strtolower(str_replace($metaData->namespace . '\\', '', $metaData->name))); $resource->setProperties($this->getEntityColumnValues($entity, $metaData)); $resource->setRelations($this->getEmbeddedRelations($entity, $metaData)); return $resource; }