Commit db464051 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Correction du bug dans UploadedFileRepository::get.

Showing with 6 additions and 5 deletions
+6 -5
...@@ -19,6 +19,7 @@ use Irstea\FileUploadBundle\Model\UploadedFileInterface; ...@@ -19,6 +19,7 @@ use Irstea\FileUploadBundle\Model\UploadedFileInterface;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;
use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Rhumsaa\Uuid\Uuid;
/** /**
* Description of UploadedFileRepository * Description of UploadedFileRepository
...@@ -91,15 +92,15 @@ class UploadedFileRepository extends EntityRepository implements FileManagerInte ...@@ -91,15 +92,15 @@ class UploadedFileRepository extends EntityRepository implements FileManagerInte
$this->log(LogLevel::INFO, 'File deleted', ['file' => $file]); $this->log(LogLevel::INFO, 'File deleted', ['file' => $file]);
} }
public function get($id) public function get($uuid)
{ {
if(!$id) { if (!$uuid) {
return null; return null;
} }
if(!is_string($id) || !\Ramsey\Uuid\Uuid::isValid($id)) { if (!is_string($uuid) || !Uuid::isValid($uuid)) {
throw new \InvalidArgumentException(sprintf("Identifiant invalide: %s", (string)$id)); throw new \InvalidArgumentException(sprintf("Identifiant invalide: %s", (string)$uuid));
} }
return $this->findOneById($id); return $this->findOneById($uuid);
} }
public function completed(UploadedFileInterface $file) public function completed(UploadedFileInterface $file)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment