<?php
namespace App\Controller\Front;
use App\Entity\ExerciseSet;
use App\Entity\ExerciseSetItem;
use App\Entity\Spirometry;
use App\Service\ExerciseService;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class MainController extends AbstractController
{
/**
* @Route("/", name="main")
*/
public function index(EntityManagerInterface $em, ExerciseService $exerciseService)
{
return $this->render('front/main/index.html.twig', [
'events' => $em->getRepository(ExerciseSet::class)->getAllEvents([
'user' => $this->getUser(),
'start' => (new \DateTime())->setTime(0,0),
'end' => (new \DateTime())->setTime(23,59, 59)->modify('+2 days')
]),
'exercises' => $exerciseService->getUserExcercises($this->getUser()),
'spirometryList' => $em->getRepository(Spirometry::class)->findLatest($this->getUser()),
'exerciseItemList' => $em->getRepository(ExerciseSetItem::class)->findLatest($this->getUser())
]);
}
}