Ported PublicFeedController.

This commit is contained in:
Alexey Skobkin 2023-04-01 20:31:40 +03:00
parent 40db2edc38
commit 77fa05f457
No known key found for this signature in database
GPG key ID: 5D5CEF6F221278E7

View file

@ -1,17 +1,18 @@
<?php <?php
declare(strict_types=1);
namespace src\PointToolsBundle\Controller; namespace App\Controller;
use Knp\Component\Pager\PaginatorInterface; use Knp\Component\Pager\PaginatorInterface;
use src\PointToolsBundle\Repository\Blogs\PostRepository; use App\Repository\Blog\PostRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\{Request, Response};
class PublicFeedController extends AbstractController class PublicFeedController extends AbstractController
{ {
private const POSTS_PER_PAGE = 20; private const POSTS_PER_PAGE = 20;
public function indexAction(Request $request, PostRepository $postRepository, PaginatorInterface $paginator) public function indexAction(Request $request, PostRepository $postRepository, PaginatorInterface $paginator): Response
{ {
$postsPagination = $paginator->paginate( $postsPagination = $paginator->paginate(
$postRepository->createPublicFeedPostsQuery(), $postRepository->createPublicFeedPostsQuery(),