src/Controller/HomeController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\CookieRepository;
  4. use App\Repository\PhotoRepository;
  5. use App\Repository\UserRepository;
  6. use DateTime;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. class HomeController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/", name="home")
  14.      */
  15.     public function index(CookieRepository $cookieRepoPhotoRepository $photoRepoUserRepository $userRepo): Response
  16.     {
  17.         /*$alia = $userRepo->find(2137);
  18.         $andy = $userRepo->find(2138);
  19.         $datedebut = new DateTime('2024-12-01');
  20.         $datefin = new DateTime('2025-01-31');
  21.         $resultatListAlia = array();
  22.         $resultatListAndy = array();
  23.         while ($datedebut <= $datefin) {
  24.             $dated = $datedebut->format('Y-m-d') . " 00:00:00";
  25.             $datef = $datedebut->format('Y-m-d') . " 23:59:59";
  26.             $resultatAlia = array($datedebut->format('Y-m-d') => $photoRepo->countByDate($alia, $dated, $datef)[0]["nb"]);
  27.             $resultatAndy = array($datedebut->format('Y-m-d') => $photoRepo->countByDate($andy, $dated, $datef)[0]["nb"]);
  28.             array_push($resultatListAlia, $resultatAlia);
  29.             array_push($resultatListAndy, $resultatAndy);
  30.             $datedebut->modify('+1 day');
  31.         }*/
  32.         return $this->render('home/index.html.twig', [
  33.             'cookie' => $cookieRepo->findCookie(true)/*,
  34.             'resultatListAlia' => $resultatListAlia,
  35.             'resultatListAndy' => $resultatListAndy*/
  36.         ]);
  37.     }
  38. }