Files
myep-team/src/Controller/Administrative/Feedback/IndexController.php
T

42 lines
1.2 KiB
PHP

<?php
namespace App\Controller\Administrative\Feedback;
use App\Repository\FeedbackRepository;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class IndexController extends AbstractController
{
public function __construct(
private readonly FeedbackRepository $feedbackRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/administrative/feedback', name: 'app_administrative_feedback_index')]
public function index(Request $request): Response
{
$query = $this
->feedbackRepository
->getListQuery()
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'feedback.createdAt',
'defaultSortDirection' => 'desc',
]
);
return $this->render('administrative/feedback/index.html.twig', [
'pagination' => $pagination,
]);
}
}