src/Controller/HomeController.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Category;
  4. use App\Entity\Speaker;
  5. use App\Entity\SpeakerConsultation;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class HomeController extends AbstractController
  10. {
  11.     /**
  12.      * @Route("/", name="home")
  13.      */
  14.     public function index(): Response
  15.     {
  16.         $em $this->getDoctrine()->getManager();
  17.         return $this->render('home/index.html.twig', [
  18.             'categories' => $em->getRepository(Category::class)->getListWithSpeakersCount(),
  19.             'totalSpeakers' => $em->getRepository(Speaker::class)->getTotalApproved(),
  20.             'popularSpeakers' => $em->getRepository(Speaker::class)->getPopularSpeakersWithNearestDates(),
  21.             'popularSpeakersDates' => $em->getRepository(SpeakerConsultation::class)->getNearestDatesOfPopularSpeakersGroupByMonth()
  22.         ]);
  23.     }
  24.     /**
  25.      * @Route("/about", name="about")
  26.      */
  27.     public function about(): Response {
  28.         return $this->render('home/about.html.twig');
  29.     }
  30.     /**
  31.      * @Route("/docs", name="docs")
  32.      */
  33.     public function docs(): Response {
  34.         return $this->render('home/docs.html.twig');
  35.     }
  36.     /**
  37.      * @Route("/upcoming", name="upcoming")
  38.      */
  39.     public function upcoming(): Response
  40.     {
  41.         return $this->render('home/upcoming.html.twig');
  42.     }
  43. }