src/Controller/HomeController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\ActuRepository;
  4. use App\Repository\NewsRepository;
  5. use App\Repository\ProductRepository;
  6. use App\Service\CartManager;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. class HomeController extends AbstractController
  11. {
  12.     #[Route('/'name'home')]
  13.     public function index(NewsRepository $newsRepositoryProductRepository $productRepositoryCartManager $cartManagerActuRepository $actuRepository): Response
  14.     {
  15.         return $this->render('home/index.html.twig', [
  16.             'current_menu' => 'home',
  17.             'news' => $newsRepository->findAll(),
  18.             'products' => $productRepository->findAll(),
  19.             'cart' => $cartManager->getCart(),
  20.             'actuItems' => $actuRepository->findAll()
  21.         ]);
  22.     }
  23. }