src/Controller/AccreditationDefaultController.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Accreditation;
  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 AccreditationDefaultController extends AbstractController
  11. {
  12. public function __construct(private EntityManagerInterface $em)
  13. {}
  14. /**
  15. * @CmsComponent("Embed Accreditations Slider", active=true, routeName="embed_accreditations_slider")
  16. */
  17. #[Route(path: '/tlb-accreditation/slider', name: 'embed_accreditations_slider')]
  18. public function embedAccreditationsSlider(Request $request): Response
  19. {
  20. $accreditations = $this->em->getRepository(Accreditation::class)->findBy(['active' => true, 'deleted' => false], ['sortOrder' => 'ASC']);
  21. return $this->render('@theme/accreditation/accreditations_slider.html.twig', [
  22. 'accreditations' => $accreditations,
  23. ]);
  24. }
  25. }