/** * @param string $id Site UUID. * * @return Site|null */ public function find($id) { if (!\Undine\Functions\valid_uuid($id)) { return null; } return $this->em->find(Site::class, (string) $id); }
public function reverseTransform($value) { if ($value === '') { return; } if (!\Undine\Functions\valid_uuid($value)) { throw new TransformationFailedException('Not a valid UUID.'); } $model = $this->em->getRepository($this->model)->find($value); if ($model === null) { throw new TransformationFailedException('Model with the specified UUID not found.'); } return $model; }