<?php
namespace App\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* @Route("/", name="app_homepage")
*/
public function index(EntityManagerInterface $em): Response
{
if ($this->getUser()) {
return $this->redirectToRoute('admin');
}
return $this->redirect($this->generateUrl('app_login'));
// return $this->render('home/index.html.twig', [
// 'controller_name' => 'HomeController',
// ]);
}
}