<?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 BlogController extends AbstractController
{
/**
* @Route("/blog", name="blog")
*/
public function index(Request $request, BlogRepository $blogRepository): 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);
$blogPaginator = $blogRepository->findByRequest($request);
return $this->render('blog/index.html.twig', [
'blogPaginator' => $blogPaginator,
]);
}
}