src/Controller/Publico/FaqPublicController.php line 51

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Publico;
  3. use App\Entity\Ajustes\Faq;
  4. use App\Repository\Ajustes\FaqRepository;
  5. use App\Utils\HelperUtil;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use Knp\Component\Pager\PaginatorInterface;
  8. use Sonata\SeoBundle\Seo\SeoPageInterface;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Routing\Annotation\Route;
  14. use Symfony\Contracts\Translation\TranslatorInterface;
  15. use WhiteOctober\BreadcrumbsBundle\Model\Breadcrumbs;
  16. /**
  17.  * @Route("/faqs", name="faqs_")
  18.  */
  19. class FaqPublicController extends AbstractController
  20. {
  21.     public const BASEDIR = Faq::BASEDIR;
  22.     public const ICON = Faq::ICON;
  23.     protected $em;
  24.     protected $bd;
  25.     protected $bag;
  26.     protected $pag;
  27.     protected $hlp;
  28.     protected $repo;
  29.     protected $trans;
  30.     protected $seo;
  31.     public function __construct(EntityManagerInterface $em, Breadcrumbs $bd, PaginatorInterface $pg, FaqRepository $repo, HelperUtil $hlp, ParameterBagInterface $pb, TranslatorInterface $trans, SeoPageInterface $seo)
  32.     {
  33.         $this->em = $em;
  34.         $this->bd = $bd;
  35.         $this->bag = $pb;
  36.         $this->pag = $pg;
  37.         $this->repo = $repo;
  38.         $this->hlp = $hlp;
  39.         $this->trans = $trans;
  40.         $this->seo = $seo;
  41.     }
  42.     /**
  43.      * @Route("/", name="index", options={"expose"=true})
  44.      */
  45.     public function indexAction(Request $request): Response
  46.     {
  47.         //SEO
  48.         $titulo =$this->trans->trans('faq.page.seo.title', [], 'faq');
  49.         $descripcion =$this->trans->trans('faq.page.seo.description', [], 'faq');
  50.         $this->seo 
  51.             ->setTitle($titulo)
  52.             ->addMeta('name', 'description', $descripcion)
  53.             ->addMeta('property', 'og:title', $titulo)
  54.             ->addMeta('property', 'og:description', $descripcion)
  55.         ;
  56.         return $this->render(self::BASEDIR.'/faq_page_list.html.twig', [
  57.             'BaseDir' => self::BASEDIR,
  58.             'ICON' => self::ICON,
  59.         ]);
  60.     }
  61. }