From db464051a2d736313ed05aaf84daacee58313e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Fri, 29 May 2015 11:39:13 +0200 Subject: [PATCH] Correction du bug dans UploadedFileRepository::get. --- Entity/Repository/UploadedFileRepository.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Entity/Repository/UploadedFileRepository.php b/Entity/Repository/UploadedFileRepository.php index 6c949387..14d362d8 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) -- GitLab