src/Controller/HomeController.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Service;
  4. use App\Entity\Category;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. class HomeController extends AbstractController
  10. {
  11.     /**
  12.      * @Route("/", name="app_home")
  13.      */
  14.     public function home(EntityManagerInterface $entityManager): Response
  15.     {
  16.         $categories $entityManager->getRepository(Category::class)->findAll();
  17.         return $this->render('home/index.html.twig', [
  18.             'categories' => $categories,
  19.         ]);
  20.     }
  21. //-----------------------------------------------TEST 1----AFFICHAGE SERVICES DANS NAV------------------------------------
  22.     /**
  23.     * @Route("/category", name="app_render_categories_in_nav", methods={"GET"})
  24.     */
  25.     public function renderCategoriesInNav(EntityManagerInterface $entityManager): Response
  26.     {
  27.         $categories $entityManager->getRepository(Category::class)->findAll();
  28.         return $this->render('rendered/nav_categories.html.twig', [
  29.             'categories' => $categories
  30.         ]);
  31.     }
  32.     
  33. }