Configure database sessions

This commit is contained in:
2024-07-03 11:03:13 +02:00
parent 1a5ba16ef9
commit 096d35d5cf
23 changed files with 1008 additions and 24 deletions

View File

@@ -2,22 +2,36 @@
namespace App\Controller;
use App\Entity\Conference;
use App\Repository\CommentRepository;
use App\Repository\ConferenceRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class ConferenceController extends AbstractController
{
#[Route('/', name: 'homepage')]
public function index(): Response
public function index(ConferenceRepository $conferenceRepository): Response
{
return new Response(<<<EOF
<html>
<body>
<img src="/images/under-construction.gif" />
</body>
</html>
EOF
);
return $this->render('conference/index.html.twig', [
'conferences' => $conferenceRepository->findAll(),
]);
}
#[Route('/conference/{id}', name: 'conference')]
public function show(Request $request, Conference $conference, CommentRepository $commentRepository): Response
{
$offset = max(0, $request->query->getInt('offset', 0));
$paginator = $commentRepository->getCommentPaginator($conference, $offset);
return $this->render('conference/show.html.twig', [
'conference' => $conference,
'comments' => $paginator,
'previous' => $offset - CommentRepository::COMMENTS_PER_PAGE,
'next' => min(count($paginator), $offset + CommentRepository::COMMENTS_PER_PAGE),
]);
}
}