src/Form/UserType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\User;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\TextType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\OptionsResolver\OptionsResolver;
  9. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  10. class UserType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('email'EmailType::class)
  16.             ->add('password'PasswordType::class)
  17.             ->add('passwordConfirm'PasswordType::class, ['mapped' => false])
  18.             ->add('name'TextType::class)
  19.             ->add('lastname'TextType::class)
  20.         ;
  21.     }
  22.     public function configureOptions(OptionsResolver $resolver): void
  23.     {
  24.         $resolver->setDefaults([
  25.             'data_class' => User::class,
  26.         ]);
  27.     }
  28. }