Test Setup Failed
Push — master ( 584547...730ac2 )
by Alexey
14:04
created

PublicFeedController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 3
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\Controller;
4
5
use Knp\Component\Pager\Paginator;
6
use Skobkin\Bundle\PointToolsBundle\Repository\Blogs\PostRepository;
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\Request;
9
10
class PublicFeedController extends AbstractController
11
{
12
    private const POSTS_PER_PAGE = 20;
13
14
    public function indexAction(Request $request, PostRepository $postRepository, Paginator $paginator)
15
    {
16
        $postsPagination = $paginator->paginate(
17
            $postRepository->createPublicFeedPostsQuery(),
18
            $request->query->getInt('page', 1),
19
            self::POSTS_PER_PAGE
20
        );
21
22
        return $this->render(
23
            'SkobkinPointToolsBundle:Post:feed.html.twig',
24
            [
25
                // @todo Move to translation
26
                'feed_title' => 'All',
27
                'posts' => $postsPagination,
28
                // Special feed mark (to not show comments and other)
29
                'is_feed' => true,
30
            ]
31
        );
32
    }
33
}
34