Bundle/BlogBundle/Controller/BlogController.php
public function deleteAction(BasePage $blog)
    {
        if (!$this->get('security.authorization_checker')->isGranted('ROLE_VICTOIRE', $blog)) {
            throw new AccessDeniedException("Nop ! you can't do such an action");
        }

        foreach ($blog->getArticles() as $_article) {
            $bep = $this->get('victoire_page.page_helper')->findPageByParameters(
                [
                    'templateId' => $_article->getTemplate()->getId(),
                    'entityId'   => $_article->getId(),
                ]
            );
            $this->get('victoire_blog.manager.article')->delete($_article, $bep);
        }

        return new JsonResponse(parent::deleteAction($blog));
    }
public function deleteAction(BasePage $blog)
    {
        if (!$this->get('security.authorization_checker')->isGranted('ROLE_VICTOIRE', $blog)) {
            throw new AccessDeniedException("Nop ! you can't do such an action");
        }

        foreach ($blog->getArticles() as $_article) {
            $bep = $this->get('victoire_page.page_helper')->findPageByParameters(
                [
                    'templateId' => $_article->getTemplate()->getId(),
                    'entityId'   => $_article->getId(),
                ]
            );
            $this->get('victoire_blog.manager.article')->delete($_article, $bep);
        }

        return new JsonResponse(parent::deleteAction($blog));
    }
public function deleteAction ( BasePage $ blog ) { if ( ! $ this -> get ( 'security.authorization_checker' ) -> isGranted ( 'ROLE_VICTOIRE' , $ blog ) ) { throw new AccessDeniedException ( "Nop ! you can't do such an action" ) ; } foreach ( $ blog -> getArticles ( ) as $ _article ) { $ bep = $ this -> get ( 'victoire_page.page_helper' ) -> findPageByParameters ( [ 'templateId' => $ _article -> getTemplate ( ) -> getId ( ) , 'entityId' => $ _article -> getId ( ) , ] ) ; $ this -> get ( 'victoire_blog.manager.article' ) -> delete ( $ _article , $ bep ) ; } return new JsonResponse ( parent :: deleteAction ( $ blog ) ) ; }
Delete a Blog.

@param BasePage $blog

@Route("/{id}/delete", name="victoire_blog_delete")
@ParamConverter("blog", class="VictoirePageBundle:BasePage")

@throws \Victoire\Bundle\ViewReferenceBundle\Exception\ViewReferenceNotFoundException

@return JsonResponse
Delete a Blog .