Bundle/BlogBundle/Controller/ArticleController.php
public function deleteAction(Article $article)
    {
        $blogViewReference = $this->container->get('victoire_view_reference.repository')
            ->getOneReferenceByParameters(['viewId' => $article->getBlog()->getId()]);

        $this->get('victoire_blog.manager.article')->delete($article);

        $message = $this->get('translator')->trans('victoire.blog.article.delete.success', [], 'victoire');
        $this->congrat($message);

        $response = [
            'success' => true,
            'url'     => $this->generateUrl('victoire_core_page_show', [
                    'url' => $blogViewReference->getUrl(),
                ]
            ),
            'message' => $message,
        ];

        return new JsonResponse($response);
    }
public function deleteAction(Article $article)
    {
        $blogViewReference = $this->container->get('victoire_view_reference.repository')
            ->getOneReferenceByParameters(['viewId' => $article->getBlog()->getId()]);

        $this->get('victoire_blog.manager.article')->delete($article);

        $message = $this->get('translator')->trans('victoire.blog.article.delete.success', [], 'victoire');
        $this->congrat($message);

        $response = [
            'success' => true,
            'url'     => $this->generateUrl('victoire_core_page_show', [
                    'url' => $blogViewReference->getUrl(),
                ]
            ),
            'message' => $message,
        ];

        return new JsonResponse($response);
    }
public function deleteAction ( Article $ article ) { $ blogViewReference = $ this -> container -> get ( 'victoire_view_reference.repository' ) -> getOneReferenceByParameters ( [ 'viewId' => $ article -> getBlog ( ) -> getId ( ) ] ) ; $ this -> get ( 'victoire_blog.manager.article' ) -> delete ( $ article ) ; $ message = $ this -> get ( 'translator' ) -> trans ( 'victoire.blog.article.delete.success' , [ ] , 'victoire' ) ; $ this -> congrat ( $ message ) ; $ response = [ 'success' => true , 'url' => $ this -> generateUrl ( 'victoire_core_page_show' , [ 'url' => $ blogViewReference -> getUrl ( ) , ] ) , 'message' => $ message , ] ; return new JsonResponse ( $ response ) ; }
Delete a Blog Article.

@param Article $article

@Route("/{id}/delete", name="victoire_core_article_delete")
@ParamConverter("article", class="VictoireBlogBundle:Article")

@return JsonResponse
Delete a Blog Article .