src/Controller/Privado/DashboardController.php line 59

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Privado;
  3. use App\Entity\Ajustes\Slider;
  4. use App\Entity\Catalogo\Categoria;
  5. use App\Entity\Catalogo\Producto;
  6. use App\Repository\Ajustes\SliderRepository;
  7. use App\Repository\Catalogo\CategoriaRepository;
  8. use App\Repository\Catalogo\ProductoRepository;
  9. use App\Service\EmailService;
  10. use App\Utils\FilterSession;
  11. use App\Utils\HelperUtil;
  12. use Doctrine\ORM\EntityManagerInterface;
  13. use Knp\Component\Pager\PaginatorInterface;
  14. use Sonata\SeoBundle\Seo\SeoPageInterface;
  15. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  16. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  17. use Symfony\Component\HttpFoundation\Request;
  18. use Symfony\Component\HttpFoundation\Response;
  19. use Symfony\Component\Routing\Annotation\Route;
  20. use Symfony\Contracts\Translation\TranslatorInterface;
  21. use WhiteOctober\BreadcrumbsBundle\Model\Breadcrumbs;
  22. class DashboardController extends AbstractController
  23. {
  24.     public const BASEDIR Categoria::BASEDIR;
  25.     public const ICON Categoria::ICON;
  26.     protected $em;
  27.     protected $bd;
  28.     protected $bag;
  29.     protected $pag;
  30.     protected $hlp;
  31.     protected $repo;
  32.     protected $trans;
  33.     private $seo;
  34.     public function __construct(EntityManagerInterface $emBreadcrumbs $bdPaginatorInterface $pgProductoRepository $repoCategoriaRepository $CatRepoSliderRepository $SliRepoHelperUtil $hlpParameterBagInterface $pbTranslatorInterface $transSeoPageInterface $seo)
  35.     {
  36.         $this->em $em;
  37.         $this->bd $bd;
  38.         $this->bag $pb;
  39.         $this->pag $pg;
  40.         $this->repo $repo;
  41.         $this->CatRepo $CatRepo;
  42.         $this->SliRepo $SliRepo;
  43.         $this->hlp $hlp;
  44.         $this->trans $trans
  45.         $this->seo   $seo;
  46.     }
  47.     /**
  48.      * @Route("/", name="index", options={"expose"=true})
  49.      *
  50.      * @param null|mixed $cat
  51.      */
  52.     public function indexAction(Request $requestEmailService $servEmails): Response
  53.     {
  54.         $sliders $this->SliRepo->findBy(['SliEstado' => '1']);
  55.         //SEO
  56.         $titulo =$this->trans->trans('inicio.seo.title', [], 'inicio');
  57.         $descripcion =$this->trans->trans('inicio.seo.desc', [], 'inicio');
  58.         $this->seo 
  59.             ->setTitle($titulo)
  60.             ->addMeta('name''description'$descripcion)
  61.             ->addMeta('property''og:title'$titulo)
  62.             ->addMeta('property''og:description'$descripcion)
  63.         ;
  64.         return $this->render('pages/privado/dashboard.html.twig', [
  65.             'BaseDir' => self::BASEDIR,
  66.             'BaseDirSlider' => Slider::BASEDIR,
  67.             'BaseDirProducto' => Producto::BASEDIR,
  68.             'ICON' => '<i class="fas fa-home"></i>',
  69.             'Sliders' => $sliders,
  70.         ]);
  71.     }
  72. }