Closed FabRiviere closed 1 year ago
Modification de la fonction show() dans l contrôleur ConferenceController.php :
#[Route('/conference/{id}', name: 'conference')]
public function show(Request $request, Environment $twig, Conference $conference, CommentRepository $commentRepository): Response
{
$offset = max(0, $request->query->getInt('offset', 0));
$paginator = $commentRepository->getCommentPaginator($conference, $offset);
return new Response($twig->render('conference/show.html.twig', [
'conference' => $conference,
'comments' => $paginator,
'previous' => $offset - CommentRepository::PAGINATOR_PER_PAGE,
'next' => min(count($paginator), $offset + CommentRepository::PAGINATOR_PER_PAGE),
]));
}