Exemple #1
0
 /**
  * @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);
 }
Exemple #2
0
 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;
 }