public function removeAction($pageId)
    {
        $page = $this->getPage($pageId);
        if ($page->getSlug() == '')
        {
            throw new AccessDeniedException();
        }
        $request = $this->getRequest();
        if ($request->request->get('confirm') === 'yes')
        {
            if ($this->container->getParameter('fulgurio_light_cms.allow_recursive_page_delete') == FALSE
                    && $page->hasChildren())
            {
                $this->get('session')->getFlashBag()->add(
                        'error',
                        $this->get('translator')->trans('fulgurio.lightcms.pages.recursive_remove_not_allowed', array(), 'admin')
                );
                return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $pageId)));
            }
            $em = $this->getDoctrine()->getManager();

            $em->remove($page);
            $em->flush();
            $this->get('session')->getFlashBag()->add(
                    'success',
                    $this->get('translator')->trans('fulgurio.lightcms.pages.delete_success_message', array(), 'admin')
            );
            if ($page->getParentId())
            {
                return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $page->getParentId())));
            }
            return $this->redirect($this->generateUrl('AdminPages'));
        }
        else if ($request->request->get('confirm') === 'no')
        {
            return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $pageId)));
        }
        $templateName = $request->isXmlHttpRequest() ? 'FulgurioLightCMSBundle::adminConfirmAjax.html.twig' : 'FulgurioLightCMSBundle::adminConfirm.html.twig';
        return $this->render($templateName, array(
            'action' => $this->generateUrl('AdminPagesRemove', array('pageId' => $pageId)),
            'confirmationMessage' => $this->get('translator')->trans('fulgurio.lightcms.pages.delete_confirm_message', array('%title%' => $page->getTitle()), 'admin'),
        ));
    }
public function removeAction($pageId)
    {
        $page = $this->getPage($pageId);
        if ($page->getSlug() == '')
        {
            throw new AccessDeniedException();
        }
        $request = $this->getRequest();
        if ($request->request->get('confirm') === 'yes')
        {
            if ($this->container->getParameter('fulgurio_light_cms.allow_recursive_page_delete') == FALSE
                    && $page->hasChildren())
            {
                $this->get('session')->getFlashBag()->add(
                        'error',
                        $this->get('translator')->trans('fulgurio.lightcms.pages.recursive_remove_not_allowed', array(), 'admin')
                );
                return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $pageId)));
            }
            $em = $this->getDoctrine()->getManager();

            $em->remove($page);
            $em->flush();
            $this->get('session')->getFlashBag()->add(
                    'success',
                    $this->get('translator')->trans('fulgurio.lightcms.pages.delete_success_message', array(), 'admin')
            );
            if ($page->getParentId())
            {
                return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $page->getParentId())));
            }
            return $this->redirect($this->generateUrl('AdminPages'));
        }
        else if ($request->request->get('confirm') === 'no')
        {
            return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $pageId)));
        }
        $templateName = $request->isXmlHttpRequest() ? 'FulgurioLightCMSBundle::adminConfirmAjax.html.twig' : 'FulgurioLightCMSBundle::adminConfirm.html.twig';
        return $this->render($templateName, array(
            'action' => $this->generateUrl('AdminPagesRemove', array('pageId' => $pageId)),
            'confirmationMessage' => $this->get('translator')->trans('fulgurio.lightcms.pages.delete_confirm_message', array('%title%' => $page->getTitle()), 'admin'),
        ));
    }
public function removeAction ( $ pageId ) { $ page = $ this -> getPage ( $ pageId ) ; if ( $ page -> getSlug ( ) == '' ) { throw new AccessDeniedException ( ) ; } $ request = $ this -> getRequest ( ) ; if ( $ request -> request -> get ( 'confirm' ) === 'yes' ) { if ( $ this -> container -> getParameter ( 'fulgurio_light_cms.allow_recursive_page_delete' ) == FALSE && $ page -> hasChildren ( ) ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'error' , $ this -> get ( 'translator' ) -> trans ( 'fulgurio.lightcms.pages.recursive_remove_not_allowed' , array ( ) , 'admin' ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'AdminPagesSelect' , array ( 'pageId' => $ pageId ) ) ) ; } $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ page ) ; $ em -> flush ( ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , $ this -> get ( 'translator' ) -> trans ( 'fulgurio.lightcms.pages.delete_success_message' , array ( ) , 'admin' ) ) ; if ( $ page -> getParentId ( ) ) { return $ this -> redirect ( $ this -> generateUrl ( 'AdminPagesSelect' , array ( 'pageId' => $ page -> getParentId ( ) ) ) ) ; } return $ this -> redirect ( $ this -> generateUrl ( 'AdminPages' ) ) ; } else if ( $ request -> request -> get ( 'confirm' ) === 'no' ) { return $ this -> redirect ( $ this -> generateUrl ( 'AdminPagesSelect' , array ( 'pageId' => $ pageId ) ) ) ; } $ templateName = $ request -> isXmlHttpRequest ( ) ? 'FulgurioLightCMSBundle::adminConfirmAjax.html.twig' : 'FulgurioLightCMSBundle::adminConfirm.html.twig' ; return $ this -> render ( $ templateName , array ( 'action' => $ this -> generateUrl ( 'AdminPagesRemove' , array ( 'pageId' => $ pageId ) ) , 'confirmationMessage' => $ this -> get ( 'translator' ) -> trans ( 'fulgurio.lightcms.pages.delete_confirm_message' , array ( '%title%' => $ page -> getTitle ( ) ) , 'admin' ) , ) ) ; }
Remove page, with confirm form

@param number $pageId
Remove page with confirm form