<?php
namespace App\Controller\Blog;
use App\Entity\Main\Blog;
use App\Repository\Main\BlogRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class PageController extends AbstractController
{
/**
* @Route("/blog/page/{page}", name="blog_page")
*/
public function index(Request $request, BlogRepository $blogRepository, $page): Response
{
$request->query->set('status_id', Blog::STATUS['ACTIVE']);
$request->query->set('locale', $request->getLocale());
$request->query->set('sort_by', 'id');
$request->query->set('sort_order', 'DESC');
$request->query->set('per_page', 6);
$request->query->set('page', $page);
$blogPaginator = $blogRepository->findByRequest($request);
return $this->render('blog/index.html.twig', [
'blogPaginator' => $blogPaginator,
]);
}
}