src/Controller/AdvertsCategoryAdminListController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\AdminList\AdvertsCategoryAdminListConfigurator;
  4. use Kunstmaan\ArticleBundle\Controller\AbstractArticleCategoryAdminListController;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\HttpFoundation\Response;
  10. /**
  11.  * @Route("/{_locale}/%kunstmaan_admin.admin_prefix%/category", requirements={"_locale"="%requiredlocales%"})
  12.  */
  13. class AdvertsCategoryAdminListController extends AbstractArticleCategoryAdminListController
  14. {
  15.     private $roles = ['ROLE_ADVERTS_ADMIN'];
  16.     /**
  17.      * The index action
  18.      *
  19.      * @Route("/adverts", name="app_admin_advertscategory")
  20.      * @return array
  21.      */
  22.     public function indexAction(Request $request)
  23.     {
  24.         if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
  25.             throw $this->createAccessDeniedException();
  26.         }
  27.         return parent::doIndexAction($this->getAdminListConfigurator($request), $request);
  28.     }
  29.     /**
  30.      * The add action
  31.      *
  32.      * @Route("/adverts/add", name="app_admin_advertscategory_add", methods={"GET", "POST"})
  33.      * @return array
  34.      */
  35.     public function addAction(Request $request)
  36.     {
  37.         if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
  38.             throw $this->createAccessDeniedException();
  39.         }
  40.         return parent::doAddAction($this->getAdminListConfigurator($request), null$request);
  41.     }
  42.     /**
  43.      * The edit action
  44.      *
  45.      * @param int $id
  46.      *
  47.      * @Route("/adverts/{id}", requirements={"id" = "\d+"}, name="app_admin_advertscategory_edit", methods={"GET", "POST"})
  48.      *
  49.      * @return Response
  50.      */
  51.     public function editAction(Request $request$id)
  52.     {
  53.         if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
  54.             throw $this->createAccessDeniedException();
  55.         }
  56.         return parent::doEditAction($this->getAdminListConfigurator($request), $id$request);
  57.     }
  58.     /**
  59.      * The edit action
  60.      *
  61.      * @param int $id
  62.      *
  63.      * @Route("/adverts/{id}", requirements={"id" = "\d+"}, name="app_admin_advertscategory_view", methods={"GET"})
  64.      *
  65.      * @return Response
  66.      */
  67.     public function viewAction(Request $request$id)
  68.     {
  69.         if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
  70.             throw $this->createAccessDeniedException();
  71.         }
  72.         return parent::doViewAction($this->getAdminListConfigurator($request), $id$request);
  73.     }
  74.     /**
  75.      * The delete action
  76.      *
  77.      * @param int $id
  78.      *
  79.      * @Route("/adverts/{id}/delete", requirements={"id" = "\d+"}, name="app_admin_advertscategory_delete", methods={"GET", "POST"})
  80.      *
  81.      * @return Response
  82.      */
  83.     public function deleteAction(Request $request$id)
  84.     {
  85.         if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
  86.             throw $this->createAccessDeniedException();
  87.         }
  88.         return parent::doDeleteAction($this->getAdminListConfigurator($request), $id$request);
  89.     }
  90.     /**
  91.      * The export action
  92.      *
  93.      * @param string $_format
  94.      *
  95.      * @Route("/adverts/export.{_format}", requirements={"_format" = "csv|xlsx|ods"}, name="app_admin_advertscategory_export", methods={"GET", "POST"})
  96.      * @return array
  97.      */
  98.     public function exportAction(Request $request$_format)
  99.     {
  100.         return parent::doExportAction($this->getAdminListConfigurator($request), $_format$request);
  101.     }
  102.     /**
  103.      * The move up action
  104.      *
  105.      * @param int $id
  106.      *
  107.      * @Route("/adverts/{id}/move-up", requirements={"id" = "\d+"}, name="app_admin_advertscategory_move_up", methods={"GET"})
  108.      *
  109.      * @return Response
  110.      */
  111.     public function moveUpAction(Request $request$id)
  112.     {
  113.         if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
  114.             throw $this->createAccessDeniedException();
  115.         }
  116.         return parent::doMoveUpAction($this->getAdminListConfigurator($request), $id$request);
  117.     }
  118.     /**
  119.      * The move down action
  120.      *
  121.      * @param int $id
  122.      *
  123.      * @Route("/adverts/{id}/move-down", requirements={"id" = "\d+"}, name="app_admin_advertscategory_move_down", methods={"GET"})
  124.      *
  125.      * @return array
  126.      */
  127.     public function moveDownAction(Request $request$id)
  128.     {
  129.         if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
  130.             throw $this->createAccessDeniedException();
  131.         }
  132.         return parent::doMoveDownAction($this->getAdminListConfigurator($request), $id$request);
  133.     }
  134.     /**
  135.      * @return AdvertsCategoryAdminListConfigurator
  136.      */
  137.     public function createAdminListConfigurator()
  138.     {
  139.         return new AdvertsCategoryAdminListConfigurator($this->em$this->aclHelper);
  140.     }
  141. }