37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Form\RegistrationFormType;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use App\Repository\ParticipantRepository;
|
|
|
|
class ProfileController extends AbstractController
|
|
{
|
|
#[Route('/profile/{uuid}', name: 'profile_view', methods: ['GET'])]
|
|
public function viewProfile(string $uuid, ParticipantRepository $participantRepository): Response
|
|
{
|
|
$currentProfile = $participantRepository->findOneBy(['idParticipant' => $uuid]);
|
|
return $this->render('profile/view.html.twig', [
|
|
'profile' => $currentProfile,
|
|
]);
|
|
}
|
|
|
|
#[Route('/profile/edit/{uuid}', name: 'profile_edit', methods: ['GET', 'POST'])]
|
|
public function editProfile(string $uuid, ParticipantRepository $participantRepository, Request $request): Response
|
|
{
|
|
$currentProfile = $participantRepository->findOneBy(['idParticipant' => $uuid]);
|
|
$form = $this->createForm(RegistrationFormType::class, $currentProfile);
|
|
$form->handleRequest($request);
|
|
if ($form->isSubmitted() && $form->isValid()) {
|
|
|
|
}
|
|
return $this->render('profile/view.html.twig', [
|
|
'profile' => $currentProfile,
|
|
]);
|
|
}
|
|
}
|