<?php
namespace App\Controller;
use App\Repository\FieldOfWorkRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class IndexController extends AbstractController
{
/**
* @Route("/", name="app_index")
*/
public function index(): Response
{
if ($this->isGranted('ROLE_DISTRICT')) {
return $this->redirectToRoute('app_district');
}
if ($this->isGranted('ROLE_MANAGER')) {
return $this->redirectToRoute('app_manager');
}
if ($this->isGranted('ROLE_JURY')) {
return $this->redirectToRoute('app_jury_index');
}
return $this->render('index/index.html.twig', [
]);
}
/**
* @Route("/fow", name="app_fow")
*/
public function fow(FieldOfWorkRepository $fieldOfWorkRepository): Response
{
$fieldsOfWork = $fieldOfWorkRepository->findBy(['active' => true], ['sorting' => 'asc']);
return $this->render('index/fow.html.twig', [
'fieldsOfWork' => $fieldsOfWork
]);
}
}