src/Controller/IndexController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\FieldOfWorkRepository;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class IndexController extends AbstractController
  9. {
  10.     /**
  11.      * @Route("/", name="app_index")
  12.      */
  13.     public function index(): Response
  14.     {
  15.         if ($this->isGranted('ROLE_DISTRICT')) {
  16.             return $this->redirectToRoute('app_district');
  17.         }
  18.         if ($this->isGranted('ROLE_MANAGER')) {
  19.             return $this->redirectToRoute('app_manager');
  20.         }
  21.         if ($this->isGranted('ROLE_JURY')) {
  22.             return $this->redirectToRoute('app_jury_index');
  23.         }
  24.         return $this->render('index/index.html.twig', [
  25.         ]);
  26.     }
  27.     /**
  28.      * @Route("/fow", name="app_fow")
  29.      */
  30.     public function fow(FieldOfWorkRepository $fieldOfWorkRepository): Response
  31.     {
  32.         $fieldsOfWork $fieldOfWorkRepository->findBy(['active' => true], ['sorting' => 'asc']);
  33.         return $this->render('index/fow.html.twig', [
  34.             'fieldsOfWork' => $fieldsOfWork
  35.         ]);
  36.     }
  37. }