<?php
namespace App\Controller;
use App\AdminList\AdvertsCategoryAdminListConfigurator;
use Kunstmaan\ArticleBundle\Controller\AbstractArticleCategoryAdminListController;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* @Route("/{_locale}/%kunstmaan_admin.admin_prefix%/category", requirements={"_locale"="%requiredlocales%"})
*/
class AdvertsCategoryAdminListController extends AbstractArticleCategoryAdminListController
{
private $roles = ['ROLE_ADVERTS_ADMIN'];
/**
* The index action
*
* @Route("/adverts", name="app_admin_advertscategory")
* @return array
*/
public function indexAction(Request $request)
{
if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
throw $this->createAccessDeniedException();
}
return parent::doIndexAction($this->getAdminListConfigurator($request), $request);
}
/**
* The add action
*
* @Route("/adverts/add", name="app_admin_advertscategory_add", methods={"GET", "POST"})
* @return array
*/
public function addAction(Request $request)
{
if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
throw $this->createAccessDeniedException();
}
return parent::doAddAction($this->getAdminListConfigurator($request), null, $request);
}
/**
* The edit action
*
* @param int $id
*
* @Route("/adverts/{id}", requirements={"id" = "\d+"}, name="app_admin_advertscategory_edit", methods={"GET", "POST"})
*
* @return Response
*/
public function editAction(Request $request, $id)
{
if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
throw $this->createAccessDeniedException();
}
return parent::doEditAction($this->getAdminListConfigurator($request), $id, $request);
}
/**
* The edit action
*
* @param int $id
*
* @Route("/adverts/{id}", requirements={"id" = "\d+"}, name="app_admin_advertscategory_view", methods={"GET"})
*
* @return Response
*/
public function viewAction(Request $request, $id)
{
if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
throw $this->createAccessDeniedException();
}
return parent::doViewAction($this->getAdminListConfigurator($request), $id, $request);
}
/**
* The delete action
*
* @param int $id
*
* @Route("/adverts/{id}/delete", requirements={"id" = "\d+"}, name="app_admin_advertscategory_delete", methods={"GET", "POST"})
*
* @return Response
*/
public function deleteAction(Request $request, $id)
{
if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
throw $this->createAccessDeniedException();
}
return parent::doDeleteAction($this->getAdminListConfigurator($request), $id, $request);
}
/**
* The export action
*
* @param string $_format
*
* @Route("/adverts/export.{_format}", requirements={"_format" = "csv|xlsx|ods"}, name="app_admin_advertscategory_export", methods={"GET", "POST"})
* @return array
*/
public function exportAction(Request $request, $_format)
{
return parent::doExportAction($this->getAdminListConfigurator($request), $_format, $request);
}
/**
* The move up action
*
* @param int $id
*
* @Route("/adverts/{id}/move-up", requirements={"id" = "\d+"}, name="app_admin_advertscategory_move_up", methods={"GET"})
*
* @return Response
*/
public function moveUpAction(Request $request, $id)
{
if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
throw $this->createAccessDeniedException();
}
return parent::doMoveUpAction($this->getAdminListConfigurator($request), $id, $request);
}
/**
* The move down action
*
* @param int $id
*
* @Route("/adverts/{id}/move-down", requirements={"id" = "\d+"}, name="app_admin_advertscategory_move_down", methods={"GET"})
*
* @return array
*/
public function moveDownAction(Request $request, $id)
{
if (!$this->get('security.authorization_checker')->isGranted($this->roles)) {
throw $this->createAccessDeniedException();
}
return parent::doMoveDownAction($this->getAdminListConfigurator($request), $id, $request);
}
/**
* @return AdvertsCategoryAdminListConfigurator
*/
public function createAdminListConfigurator()
{
return new AdvertsCategoryAdminListConfigurator($this->em, $this->aclHelper);
}
}