From e729450c6405da3173f14f08e230dab7b092c72d Mon Sep 17 00:00:00 2001 From: barillote Date: Thu, 21 Nov 2024 17:16:41 +0100 Subject: [PATCH] formregister --- migrations/Version20241121153037.php | 31 +++++++++++++++++ src/Entity/Announcement.php | 4 +-- src/Form/RegistrationFormType.php | 42 ++++++++++++++++++----- templates/registration/register.html.twig | 5 ++- 4 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 migrations/Version20241121153037.php diff --git a/migrations/Version20241121153037.php b/migrations/Version20241121153037.php new file mode 100644 index 0000000..9a792b8 --- /dev/null +++ b/migrations/Version20241121153037.php @@ -0,0 +1,31 @@ +addSql('CREATE SCHEMA public'); + } +} diff --git a/src/Entity/Announcement.php b/src/Entity/Announcement.php index 10e9d9d..757de84 100644 --- a/src/Entity/Announcement.php +++ b/src/Entity/Announcement.php @@ -26,8 +26,8 @@ class Announcement #[ORM\JoinColumn(nullable: false)] private ?Company $company = null; - #[ORM\Column(length: 255)] - private ?string $status = 'notVerified'; + #[ORM\Column(nullable: false)] + private ?string $status = null; /** * @var ?Collection diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php index 264b544..012084f 100644 --- a/src/Form/RegistrationFormType.php +++ b/src/Form/RegistrationFormType.php @@ -3,11 +3,12 @@ namespace App\Form; use App\Entity\UserApp; -use Doctrine\DBAL\Types\StringType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\IsTrue; @@ -19,15 +20,38 @@ class RegistrationFormType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('nickname') - ->add('agreeTerms', CheckboxType::class, [ - 'mapped' => false, - 'constraints' => [ - new IsTrue([ - 'message' => 'Vous devez accepter les conditions d\'utilisation.', - ]), - ], + ->add('nickname', TextType::class, [ + 'label' => 'Utilisateur : ', ]) + ->add('firstname', TextType::class, [ + 'label' => 'Prénom : ', + 'required' => true, + 'constraints' => [ + new NotBlank(), + ] + ]) + ->add('lastname', TextType::class, [ + 'label' => 'Nom : ', + 'required' => true, + 'constraints' => [ + new NotBlank(), + ] + ]) + ->add('mail', EmailType::class, [ + 'label' => 'Email : ', + 'required' => true, + 'constraints' => [ + new NotBlank(), + ] + ]) +// ->add('agreeTerms', CheckboxType::class, [ +// 'mapped' => false, +// 'constraints' => [ +// new IsTrue([ +// 'message' => 'Vous devez accepter les conditions d\'utilisation.', +// ]), +// ], +// ]) ->add('plainPassword', PasswordType::class, [ // instead of being set onto the object directly, // this is read and encoded in the controller diff --git a/templates/registration/register.html.twig b/templates/registration/register.html.twig index 7b064ed..38c6dc9 100644 --- a/templates/registration/register.html.twig +++ b/templates/registration/register.html.twig @@ -9,10 +9,13 @@ {{ form_start(registrationForm) }} {{ form_row(registrationForm.nickname) }} + {{ form_row(registrationForm.firstname) }} + {{ form_row(registrationForm.lastname) }} + {{ form_row(registrationForm.mail) }} {{ form_row(registrationForm.plainPassword, { label: 'Password' }) }} - {{ form_row(registrationForm.agreeTerms) }} +{# {{ form_row(registrationForm.agreeTerms) }}#} {{ form_end(registrationForm) }}