src/Controller/BaseCommonController.php line 40

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Produit;
  4. use App\Data\SearchData;
  5. use App\Entity\Category;
  6. use App\Form\SearchForm;
  7. use Doctrine\Persistence\ManagerRegistry;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  11. class BaseCommonController extends AbstractController
  12. {
  13.     // #[Route(path: '/', name: 'home_initial')]
  14.     public function navbar(ManagerRegistry $doctrine)
  15.     {
  16.         
  17.         $categories $doctrine->getRepository(Category::class)->findBy([],["nom"=>"ASC"]);      
  18.         
  19.         // return  $categories 
  20.         return $this->render('navbar.html.twig', ['categories' => $categories ]);
  21.         
  22.         ;
  23.     }
  24.     
  25.     public function burgerbar(ManagerRegistry $doctrine)
  26.     {
  27.         
  28.         $categories $doctrine->getRepository(Category::class)->findBy([],["nom"=>"ASC"]);      
  29.         
  30.         return $this->render('burgermenu.html.twig', ['categories' => $categories ]);
  31.         ;
  32.     }
  33.     public function searchbar(ManagerRegistry $doctrine)
  34.     {
  35.         $data = new SearchData();
  36.         $form $this->createForm(SearchForm::class, $data);
  37.         
  38.         return $this->render('searchmenu.html.twig' ,[
  39.             'form' => $form->createView()
  40.         ]);
  41.         
  42.     }
  43.     //  public function produitsFiltrer(ManagerRegistry $doctrine)
  44.     // {
  45.         
  46.     //     $produits = $doctrine->getRepository(Produit::class)->findBy([],["product_name"=>"ASC"]);      
  47.         
  48.     //     // return  $categories 
  49.     //     return $this->render('produit/produitsFiltrer.html.twig', ['produits' => $produits ]);
  50.         
  51.     //     ;
  52.     // }
  53.     
  54. }