SearchController.php 785 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\OptionsManager;
  4. use App\Service\Search;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class SearchController extends AbstractController
  10. {
  11. #[Route("/recherche", name: "search_recherche")]
  12. public function searchAction(Request $request, Search $filmSearch, OptionsManager $options): Response
  13. {
  14. $query = $request->query->get('q', "");
  15. return $this->render('videotheque/liste_'.$options->vue().'.html.twig', array(
  16. 'listeFilms' => $filmSearch->search($query),
  17. 'titre' => 'Recherche '. $query
  18. ));
  19. }
  20. }