src/Controller/HomeController.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Evento;
  4. use App\Entity\MenuCat;
  5. use App\Entity\Producto;
  6. use App\Entity\Tag;
  7. use Doctrine\ORM\EntityManagerInterface;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. class HomeController extends AbstractController
  12. {
  13.     protected $em;
  14.     public function __construct(EntityManagerInterface $manager)
  15.     {
  16.         $this->em $manager;
  17.     }
  18.     /**
  19.      * @Route("/home", name="home")
  20.      */
  21.     public function index(): Response
  22.     {
  23.         $tags $this->em->getRepository(Tag::class)->findBy(['isFeatured'=>1]);
  24.         $fprods $this->em->getRepository(Producto::class)->findBy(['isActivo'=>1'isFeatured'=>1]);
  25.         $evento $this->em->getRepository(Evento::class)->findOneBy(['isActivo'=>1'isFeatured'=>1]);
  26.         $eventos $this->em->getRepository(Evento::class)->findProximosEventos();
  27.         return $this->render('home/index.html.twig', [
  28.             'controller_name' => 'Home',
  29.             'tags' => $tags,
  30.             'prods' => $fprods,
  31.             'evento' => $evento,
  32.             'eventos' => $eventos
  33.         ]);
  34.     }
  35. }