diff --git a/Entity/Repository/UploadedFileRepository.php b/Entity/Repository/UploadedFileRepository.php index 6c949387417f192a7f677906b237da87e811e1d6..14d362d8322fe85d2e3147c874cbe749d42ee8e6 100644 --- a/Entity/Repository/UploadedFileRepository.php +++ b/Entity/Repository/UploadedFileRepository.php @@ -19,6 +19,7 @@ use Irstea\FileUploadBundle\Model\UploadedFileInterface; use Psr\Log\LogLevel; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Rhumsaa\Uuid\Uuid; /** * Description of UploadedFileRepository @@ -91,15 +92,15 @@ class UploadedFileRepository extends EntityRepository implements FileManagerInte $this->log(LogLevel::INFO, 'File deleted', ['file' => $file]); } - public function get($id) + public function get($uuid) { - if(!$id) { + if (!$uuid) { return null; } - if(!is_string($id) || !\Ramsey\Uuid\Uuid::isValid($id)) { - throw new \InvalidArgumentException(sprintf("Identifiant invalide: %s", (string)$id)); + if (!is_string($uuid) || !Uuid::isValid($uuid)) { + throw new \InvalidArgumentException(sprintf("Identifiant invalide: %s", (string)$uuid)); } - return $this->findOneById($id); + return $this->findOneById($uuid); } public function completed(UploadedFileInterface $file)