<?php
namespace App\Controller\ECommerce\App;
use App\Entity\ECommerce\ProductManufacturer;
use Knp\Component\Pager\PaginatorInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* ProductManufacturer controller.
*
* @package App\Controller\ECommerce\App
*
* @Route("/{_locale}/product_manufacturer", requirements={"_locale": "\w{2}"})
*/
class ProductManufacturerController extends AbstractController
{
/**
* Lists all productGroup entities.
*
* @Route("/index", name="mdl_app_product_manufacturer_index")
*
* @Cache(expires="+2 days", public=true)
*/
public function indexAction(Request $request, PaginatorInterface $paginator): Response
{
$productGroups = $paginator->paginate(
$this->getDoctrine()->getRepository(ProductManufacturer::class)->createPublicQueryBuilder(),
$request->query->getInt('page', 1),
$request->query->getInt('limit', 8)
);
return $this->render('ECommerce/App/Product/sidebar/Manufacturer/index.html.twig', [
'productGroups' => $productGroups,
]);
}
}