src/Flexy/FrontBundle/Controller/ProductController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Flexy\FrontBundle\Controller;
  3. use App\Flexy\FrontBundle\Repository\ProductFrontRepository;
  4. use App\Flexy\ProductBundle\Repository\ProductRepository;
  5. use App\Flexy\ShopBundle\Entity\Product\Product;
  6. use App\Flexy\ShopBundle\Repository\Shipping\CityRepository;
  7. use App\Repository\Flexy\ShopBundle\Entity\Shipping\DepartementRepository;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. #[Route('/shop')]
  12. class ProductController extends AbstractController
  13. {
  14.     #[Route('/product/{id}'name'single_product')]
  15.     public function singleProduct(Product $product,ProductFrontRepository $productFrontRepository,CityRepository $cityRepository,DepartementRepository $departementRepository): Response
  16.     {
  17.         return $this->render('@Flexy\FrontBundle/templates/products/singleProduct.html.twig', [
  18.             'singleProduct' => $product,
  19.             'associatedProducts'=>$productFrontRepository->findAll(),
  20.             'cities'=>$cityRepository->findAll(),
  21.             'departements'=>$departementRepository->findAll()
  22.         ]);
  23.     }
  24. }