From d70f111ad85af4f8c1f91fe26f6f3b06fc2540bc Mon Sep 17 00:00:00 2001 From: Serreau Jovann Date: Tue, 17 Feb 2026 09:04:20 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20protection=20contre=20cat=C3=A9gorie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Dashboard/CategoryController.php | 9 --------- templates/dashboard/category/list.twig | 2 ++ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Controller/Dashboard/CategoryController.php b/src/Controller/Dashboard/CategoryController.php index f42d811..7ec3df4 100644 --- a/src/Controller/Dashboard/CategoryController.php +++ b/src/Controller/Dashboard/CategoryController.php @@ -44,15 +44,6 @@ class CategoryController extends AbstractController ): Response { $this->appLogger->record('VIEW', 'Consultation de la page de catégorie'); - foreach (['2-7 Ans','3-15 Ans','3-99 Ans','Barnums','Alimentaire','Options'] as $catName) { - $cat = $categoryRepository->findOneBy(['name'=>$catName]); - if(!$cat instanceof Category) { - $cat = new Category(); - $cat->setName($catName); - $this->em->persist($cat); - } - $this->em->flush(); - } return $this->render('dashboard/category/list.twig', [ 'categorys' => $categoryRepository->findAll(), diff --git a/templates/dashboard/category/list.twig b/templates/dashboard/category/list.twig index 91f9951..09e7615 100644 --- a/templates/dashboard/category/list.twig +++ b/templates/dashboard/category/list.twig @@ -41,6 +41,7 @@ {# ACTIONS #}
+ {% if category.name != "2-7 Ans" %} @@ -50,6 +51,7 @@ class="p-2 bg-rose-500/10 hover:bg-rose-600 text-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/20"> + {% endif %}