src/Controller/FaqDefaultController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Faq;
  4. use App\Annotation\CmsComponent;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. class FaqDefaultController extends AbstractController
  11. {
  12.     public function __construct(private EntityManagerInterface $em)
  13.     {
  14.     }
  15.     /**
  16.      * @CmsComponent("Embed Faqs (All)", active=true, routeName="embed_faqs")
  17.      */
  18.     #[Route(path'/tlb-faqs'name'embed_faqs')]
  19.     public function embedFaqs(Request $request): Response
  20.     {
  21.         $faqs $this->em->getRepository(Faq::class)->findBy(['deleted' => false'active' => true], ['sortOrder' => 'ASC']);
  22.         return $this->render('@theme/faq/faqs.html.twig', [
  23.             'faqs' => $faqs,
  24.         ]);
  25.     }
  26.     /**
  27.      * @CmsComponent("Embed Faqs (Popular)", active=true, routeName="embed_popular_faqs")
  28.      */
  29.     #[Route(path'/tlb-faqs/popular'name'embed_popular_faqs')]
  30.     public function embedPopularFaqs(Request $request): Response
  31.     {
  32.         $faqs $this->em->getRepository(Faq::class)->findBy(['deleted' => false'active' => true'popular' => true], ['sortOrder' => 'ASC']);
  33.         return $this->render('@theme/faq/faqs_popular.html.twig', [
  34.             'faqs' => $faqs,
  35.         ]);
  36.     }
  37. }