WIP: Implement profile validation
This commit is contained in:
@@ -17,10 +17,12 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class ProfileController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ValidatorInterface $validator,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly UploadHandler $uploadHandler,
|
||||
@@ -48,6 +50,9 @@ class ProfileController extends AbstractController
|
||||
$this->updatePhoto($user, $uploadSession);
|
||||
}
|
||||
|
||||
// Validate teamer data to show missing data right away
|
||||
$errors = $this->validator->validate($teamer);
|
||||
|
||||
$form = $this->createForm(TeamerProfileType::class, $teamer, ['upload_session' => $uploadSession]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
@@ -72,6 +77,7 @@ class ProfileController extends AbstractController
|
||||
return $this->render('teamer/profile.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'teamer' => $teamer,
|
||||
'errors' => $errors,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user