<?php
namespace App\Controller;
use App\Entity\Category;
use App\Entity\Speaker;
use App\Entity\SpeakerConsultation;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
/**
* @Route("/", name="home")
*/
public function index(): Response
{
$em = $this->getDoctrine()->getManager();
return $this->render('home/index.html.twig', [
'categories' => $em->getRepository(Category::class)->getListWithSpeakersCount(),
'totalSpeakers' => $em->getRepository(Speaker::class)->getTotalApproved(),
'popularSpeakers' => $em->getRepository(Speaker::class)->getPopularSpeakersWithNearestDates(),
'popularSpeakersDates' => $em->getRepository(SpeakerConsultation::class)->getNearestDatesOfPopularSpeakersGroupByMonth()
]);
}
/**
* @Route("/about", name="about")
*/
public function about(): Response {
return $this->render('home/about.html.twig');
}
/**
* @Route("/docs", name="docs")
*/
public function docs(): Response {
return $this->render('home/docs.html.twig');
}
/**
* @Route("/upcoming", name="upcoming")
*/
public function upcoming(): Response
{
return $this->render('home/upcoming.html.twig');
}
}