<?php
namespace App\Controller;
use App\Entity\Evento;
use App\Entity\MenuCat;
use App\Entity\Producto;
use App\Entity\Tag;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
protected $em;
public function __construct(EntityManagerInterface $manager)
{
$this->em = $manager;
}
/**
* @Route("/home", name="home")
*/
public function index(): Response
{
$tags = $this->em->getRepository(Tag::class)->findBy(['isFeatured'=>1]);
$fprods = $this->em->getRepository(Producto::class)->findBy(['isActivo'=>1, 'isFeatured'=>1]);
$evento = $this->em->getRepository(Evento::class)->findOneBy(['isActivo'=>1, 'isFeatured'=>1]);
$eventos = $this->em->getRepository(Evento::class)->findProximosEventos();
return $this->render('home/index.html.twig', [
'controller_name' => 'Home',
'tags' => $tags,
'prods' => $fprods,
'evento' => $evento,
'eventos' => $eventos
]);
}
}