From ff4a50d12e64842f73606dab841257ed0b054ff7 Mon Sep 17 00:00:00 2001 From: Orka Arnest CRUZE Date: Mon, 27 Nov 2023 16:35:00 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20supprime=20variable=20non=20utilis?= =?UTF-8?q?=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Api/DatasheetController.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Controller/Api/DatasheetController.php b/src/Controller/Api/DatasheetController.php index 80715581..23c5b3bc 100644 --- a/src/Controller/Api/DatasheetController.php +++ b/src/Controller/Api/DatasheetController.php @@ -2,8 +2,8 @@ namespace App\Controller\Api; -use App\Constants\EntrepotApi\ConfigurationStatuses; use App\Constants\EntrepotApi\CommonTags; +use App\Constants\EntrepotApi\ConfigurationStatuses; use App\Constants\EntrepotApi\StoredDataTypes; use App\Exception\CartesApiException; use App\Exception\EntrepotApiException; @@ -123,13 +123,13 @@ private function getBasicInfo(string $datastoreId, string $datasheetName): array } } - $annexeUrl = $this->getParameter("annexes_url"); - $annexes = $this->entrepotApiService->annexe->getAll($datastoreId, null, null, ["datasheet_name=$datasheetName", "type=thumbnail"]); - + $annexeUrl = $this->getParameter('annexes_url'); + $annexes = $this->entrepotApiService->annexe->getAll($datastoreId, null, null, ["datasheet_name=$datasheetName", 'type=thumbnail']); + $thumbnail = null; - if (count($annexes) == 1) { + if (1 == count($annexes)) { $thumbnail = $annexes[0]; - $thumbnail['url'] = $annexeUrl . '/' . $datastore['technical_name'] . $thumbnail['paths'][0]; + $thumbnail['url'] = $annexeUrl.'/'.$datastore['technical_name'].$thumbnail['paths'][0]; } return [ @@ -137,7 +137,7 @@ private function getBasicInfo(string $datastoreId, string $datasheetName): array 'date' => new \DateTime(), // TODO : pour le moment on se sait pas ça correspond à la date de quoi 'categories' => [], 'nb_publications' => $nbPublications, - 'thumbnail' => $thumbnail + 'thumbnail' => $thumbnail, ]; } @@ -203,11 +203,10 @@ public function delete(string $datastoreId, string $datasheetName): Response } // TODO : autres données à supprimer + // Suppression des annexes - $annexeUrl = $this->getParameter("annexes_url"); - $annexes = $this->entrepotApiService->annexe->getAll($datastoreId, null, null, ["datasheet_name=$datasheetName"]); - foreach($annexes as $annexe) { + foreach ($annexes as $annexe) { $this->entrepotApiService->annexe->remove($datastoreId, $annexe['_id']); }