<?php
namespace App\Controller;
use App\Annotation\SiteMap;
use App\Entity\Product;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
class ProductController extends BaseController
{
/**
* @Route({"en": "/products", "bg": "/products"}, name="products.index")
* @SiteMap()
*/
public function productsIndex(): Response
{
$products = $this->manager()->getRepository(Product::class)->findBy(['active' => true], ['positionIndex' => 'ASC']);
return $this->render('products/index.html.twig', [
'products' => $products
]);
}
/**
* @Route("/products/{slug}", name="products.details")
* @SiteMap()
*/
public function productDetails(Product $product): Response
{
return $this->render('products/product-details.html.twig', [
'product' => $product
]);
}
}