1
0

2 Коммитууд c5ade57cc7 ... e63f90dd8a

Эзэн SHA1 Мессеж Огноо
  Sangfroid e63f90dd8a On remonte les tags dans le aside 3 долоо хоног өмнө
  Sangfroid 7b50a2cf19 Ajout de la suppression des tags orphelins après suppression d'un article 3 долоо хоног өмнө

+ 9 - 2
src/Controller/ArticleController.php

@@ -108,7 +108,7 @@ final class ArticleController extends AbstractController
             if ($publicationChoice !== null) {
                 $workflow->apply($article, $publicationChoice);
             }
-            
+
             $entityManager->flush();
             
             $tagService->clearOrphansTags();
@@ -124,11 +124,18 @@ final class ArticleController extends AbstractController
 
     #[Route('/{id}', name: 'app_article_delete', methods: ['POST'])]
     #[IsGranted('edit', 'article')]
-    public function delete(Request $request, Article $article, EntityManagerInterface $entityManager): Response
+    public function delete(
+        Request $request,
+        Article $article,
+        EntityManagerInterface $entityManager,
+        TagService $tagService
+
+    ): Response
     {
         if ($this->isCsrfTokenValid('delete'.$article->getId(), $request->getPayload()->getString('_token'))) {
             $entityManager->remove($article);
             $entityManager->flush();
+            $tagService->clearOrphansTags();
         }
 
         return $this->redirectToRoute('app_article_index', [], Response::HTTP_SEE_OTHER);

+ 12 - 10
templates/_aside.html.twig

@@ -10,6 +10,17 @@
         </ul>
     </section>
 
+    <!-- Etiquettes -->
+    {% set tags = liste_tags() %}
+    <section>
+        <h2>Etiquettes</h2>
+        <p>
+        {% for tag in tags %}
+            <a href="{{ path('app_search', {'tag': tag.name}) }}"><span class="tag">{{ tag }}</span></a>
+        {% endfor %}
+        </p>
+    </section>
+
     <!-- Section Flux -->
     <section class="feeds">
         <h2>Flux</h2>
@@ -18,7 +29,7 @@
             <li><a href="{{ path('app_feed', {'type': 'rss' }) }}">RSS</a></li>
         </ul>
     </section>
-    
+
     <!-- Section Connexion -->
     <section class="connexion">
         {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
@@ -41,15 +52,6 @@
         {% endif %}
     </section>    
     
-    {% set tags = liste_tags() %}
-    <section>
-        <h2>Etiquettes</h2>
-        <p>
-        {% for tag in tags %}
-            <a href="{{ path('app_search', {'tag': tag.name}) }}"><span class="tag">{{ tag }}</span></a>
-        {% endfor %}
-        </p>
-    </section>
     {#
     <!-- Catégories -->
     <section class="categories">