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