src/Controller/FrontendController.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use App\Entity\Event;
  7. class FrontendController extends AbstractController {
  8.     /**
  9.      * @Route("/", name="homepage")
  10.      */
  11.     public function index(EntityManagerInterface $em) {
  12.         $activeEvents $em->getRepository(Event::class)->findBy(['active' => true], ['startDate' => 'DESC']);
  13.         return $this->render('frontend/index.html.twig', [
  14.                     'activeEvents' => $activeEvents
  15.         ]);
  16.     }
  17.     /**
  18.      * @Route("/contact", name="contact")
  19.      */
  20.     public function contact() {
  21.         return $this->render('frontend/contact.html.twig');
  22.     }
  23. }