<?php
namespace App\Controller;
use App\Entity\Planning\User;
use App\Service\CustomJsonResponse;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class IndexController extends AbstractController
{
private $customJsonResponse;
private $entityManager;
private $translator;
private $urlGenerator;
private $validator;
public function __construct(
CustomJsonResponse $customJsonResponse,
EntityManagerInterface $entityManager,
TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator,
ValidatorInterface $validator
)
{
$this->customJsonResponse = $customJsonResponse;
$this->entityManager = $entityManager;
$this->translator = $translator;
$this->urlGenerator = $urlGenerator;
$this->validator = $validator;
}
/**
* @Route("/", name="app_index", methods={"GET"})
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
/** @var User $user */
$user = $this->getUser();
/*
if (
$this->isGranted('ROLE_ADMIN')
|| $this->isGranted('ROLE_ARV')
|| $this->isGranted('ROLE_VETERINAIRE_MEDICPHONE')
) {
return $this->redirectToRoute('app_dashboard');
}
if (
$this->isGranted('ROLE_ASV')
|| $this->isGranted('ROLE_VETERINAIRE_CLINIQUE')
) {
return $this->redirectToRoute('app_clinique');
}
if ($this->isGranted('ROLE_VETERINAIRE_DOMICILE')) {
return $this->redirectToRoute('app_domicile');
}
*/
# need show some error ???
return $this->redirectToRoute('app_dashboard');
}
}