Build user interface prototype

This commit is contained in:
2024-07-28 00:09:47 -04:00
parent 75afd8af57
commit cd8fe1d509
5 changed files with 115 additions and 24 deletions

View File

@@ -2,22 +2,30 @@
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\Response;
use Symfony\Component\Routing\Attribute\Route;
use Twig\Environment;
class ConferenceController extends AbstractController
{
#[Route('/', name: 'homepage')]
public function index(): Response
public function index(Environment $twig, ConferenceRepository $conferenceRepository): Response
{
return new Response(<<<EOF
<html>
<body>
<img src="/images/under-construction.gif" />
</body>
</html>
EOF
);
return new Response($twig->render('conference/index.html.twig', [
'conferences' => $conferenceRepository->findAll(),
]));
}
#[Route('/conference/{id}', name: 'conference')]
public function show(Environment $twig, Conference $conference, CommentRepository $commentRepository): Response
{
return new Response($twig->render('conference/show.html.twig', [
'conference' => $conference,
'comments' => $commentRepository->findBy(['conference' => $conference], ['createdAt' => 'DESC']),
]));
}
}