src/Controller/ProductController.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Annotation\SiteMap;
  4. use App\Entity\Product;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\HttpFoundation\Response;
  7. class ProductController extends BaseController
  8. {
  9.     /**
  10.      * @Route({"en": "/products", "bg": "/products"}, name="products.index")
  11.      * @SiteMap()
  12.      */
  13.     public function productsIndex(): Response
  14.     {
  15.         $products $this->manager()->getRepository(Product::class)->findBy(['active' => true], ['positionIndex' => 'ASC']);
  16.         return $this->render('products/index.html.twig', [
  17.             'products' => $products
  18.         ]);
  19.     }
  20.     /**
  21.      * @Route("/products/{slug}", name="products.details")
  22.      * @SiteMap()
  23.      */
  24.     public function productDetails(Product $product): Response
  25.     {
  26.         return $this->render('products/product-details.html.twig', [
  27.             'product' => $product
  28.         ]);
  29.     }
  30. }