|
@@ -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);
|