From e642cd51d7e8599537f8514bef8d5d16096dddf8 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 27 Aug 2025 16:08:29 +0200 Subject: =?UTF-8?q?optimisation=20UserController::existUsers,=20gestion=20?= =?UTF-8?q?des=20$response=20par=20le=20routeur,=20erreur=20article=20d?= =?UTF-8?q?=C3=A9j=C3=A0=20supprim=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/ArticleController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/controller/ArticleController.php') diff --git a/src/controller/ArticleController.php b/src/controller/ArticleController.php index a982d8c..71bfdc3 100644 --- a/src/controller/ArticleController.php +++ b/src/controller/ArticleController.php @@ -101,7 +101,11 @@ class ArticleController static public function deleteArticle(EntityManager $entityManager, array $json): Response { $director = new Director($entityManager); - $director->makeArticleNode($json['id'], true); + if(!$director->makeArticleNode($json['id'], true)){ + return new Response( + '{"success": false, "message": "Erreur: pas d\'article à supprimer"}', + Response::HTTP_INTERNAL_SERVER_ERROR); // 500 + } $article = $director->getArticleNode(); $section = $director->getNode(); -- cgit v1.2.3