From ddaa13239a531830f6df56516b2d8912002f5330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Wed, 28 Jan 2015 15:12:46 +0100 Subject: [PATCH] =?UTF-8?q?UploadedFile:=20ajout=20d'une=20m=C3=A9thode=20?= =?UTF-8?q?toArray().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/UploadedFile.php | 15 +++++++++++++++ Model/UploadedFileInterface.php | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/Entity/UploadedFile.php b/Entity/UploadedFile.php index c0ce6c17..e69f3079 100644 --- a/Entity/UploadedFile.php +++ b/Entity/UploadedFile.php @@ -539,4 +539,19 @@ class UploadedFile implements UploadedFileInterface } return true; } + + /** + * @return array + */ + public function toArray() + { + return [ + 'id' => $this->getId(), + 'name' => $this->getDisplayName(), + 'size' => $this->getSize(), + 'type' => $this->getMimeType(), + 'etat' => $this->getEtat(), + 'checksum' => $this->getChecksum(), + ]; + } } diff --git a/Model/UploadedFileInterface.php b/Model/UploadedFileInterface.php index 56e34c63..89604ec8 100644 --- a/Model/UploadedFileInterface.php +++ b/Model/UploadedFileInterface.php @@ -205,4 +205,10 @@ interface UploadedFileInterface * @return int */ public function copyTo($dest, $maxlen = PHP_INT_MAX, $readOffset = 0); + + + /** + * @return array + */ + public function toArray(); } -- GitLab