Chris@0: entityRepository = $entity_repository; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function resolve(NormalizerInterface $normalizer, $data, $entity_type) { Chris@0: // The normalizer is what knows the specification of the data being Chris@0: // deserialized. If it can return a UUID from that data, and if there's an Chris@0: // entity with that UUID, then return its ID. Chris@0: if (($normalizer instanceof UuidReferenceInterface) && ($uuid = $normalizer->getUuid($data))) { Chris@17: if ($entity = $this->entityRepository->loadEntityByUuid($entity_type, $uuid)) { Chris@0: return $entity->id(); Chris@0: } Chris@0: } Chris@0: return NULL; Chris@0: } Chris@0: Chris@0: }