This commit is contained in:
jleroy2023
2024-11-21 16:54:28 +01:00
parent 3d4fe031f6
commit a978f466c2
3 changed files with 76 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Controller;
use App\Repository\SiteRepository;
use App\Repository\SortieRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
@@ -11,12 +12,14 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
class MainController extends AbstractController
{
#[Route('/', name: 'home')]
public function index(TokenStorageInterface $tokenStorage, SortieRepository $sortieRepository): Response
public function index(TokenStorageInterface $tokenStorage, SortieRepository $sortieRepository, SiteRepository $siteRepository): Response
{
$token = $tokenStorage->getToken();
$userConnect = $token?->getUser();
$sorties = $sortieRepository->findAll();
$sites = $siteRepository->findAll();
return $this->render('main/index.html.twig', [
'sites' => $sites,
'profile' => $userConnect,
'sorties' => $sorties,
]);