src/Form/RegistrationFormType.php line 26
<?phpnamespace App\Form;use App\Entity\User;use Symfony\Component\Form\AbstractType;use Symfony\Component\Form\Extension\Core\Type\CheckboxType;use Symfony\Component\Form\Extension\Core\Type\PasswordType;use Symfony\Component\Form\FormBuilderInterface;use Symfony\Component\OptionsResolver\OptionsResolver;use Symfony\Component\Validator\Constraints\IsTrue;use Symfony\Component\Validator\Constraints\Length;use Symfony\Component\Validator\Constraints\NotBlank;use Symfony\Component\Form\Extension\Core\Type\ChoiceType;use Symfony\Component\Form\Extension\Core\Type\CollectionType;use Symfony\Component\Form\Extension\Core\Type\HiddenType;use Symfony\Bridge\Doctrine\Form\Type\EntityType;use App\Entity\Organization;use Doctrine\ORM\EntityRepository;use App\Entity\Province;use Symfony\Component\Form\ChoiceList\ChoiceList;use Symfony\Component\Form\Extension\Core\Type\EmailType;use Symfony\Component\Form\Extension\Core\Type\TextType;use App\Entity\Specialty;class RegistrationFormType extends AbstractType{public function buildForm(FormBuilderInterface $builder, array $options): void{$builder->add('email', EmailType::class, ['label' => 'Correo electrónico','attr' => ['autocomplete' => 'email'],])->add('name', TextType::class, ['label' => 'Nombre','attr' => ['autocomplete' => 'given-name'],])->add('lastname', TextType::class, ['label' => 'Apellidos','attr' => ['autocomplete' => 'family-name'],])->add('collegiateNumber', TextType::class, ['label' => 'Número colegiado',])->add('specialty', TextType::class, ['label' => 'Especialidad',])->add('province', EntityType::class, ['class' => Province::class,'label' => 'Provincia','mapped' => false,// 'attr' => [// 'disabled' => true,// ],])->add('organization', EntityType::class, ['class' => Organization::class,'label' => 'Hospital','attr' => ['placeholder' => 'Primero elige una provincia','disabled' => true,],'required' => true,// 'choice_attr' => ChoiceList::attr($this, function (?Organization $organization) {// return ['data-province-id' => $organization->getProvince()->getId()];// }),// 'choice_label' => function(?Organization $organization) {// return $organization->getProvince() ? $organization->getTitle().' ('.$organization->getProvince()->getName().')' : $organization->getTitle();// },])->add('agreeTerms', CheckboxType::class, [// 'label' => 'He leído y acepto la política de privacidad','mapped' => false,'constraints' => [new IsTrue(['message' => 'Tiene que aceptar la política de privacidad',]),],])->add('isAccepted1', CheckboxType::class, ['label' => 'Acepto recibir comunicaciones comerciales.','required' => false,])// ->add('isAccepted2', CheckboxType::class, [// 'label' => 'Acepto recibir comunicaciones comerciales.',// 'required' => false,// ])// ->add('isAccepted3', CheckboxType::class, [// 'label' => 'Llevar a cabo procedimientos de elaboración de perfiles o segmentación profesional para comprender mejor mis intereses, preferencias y mi opinión como profesional sanitario.',// 'required' => false,// ])->add('plainPassword', PasswordType::class, [// instead of being set onto the object directly,// this is read and encoded in the controller'mapped' => false,'attr' => ['autocomplete' => 'new-password'],'constraints' => [new NotBlank(['message' => 'Please enter a password',]),new Length(['min' => 6,'minMessage' => 'La contraseña debe tenel al menos {{ limit }} simbolos',// max length allowed by Symfony for security reasons'max' => 4096,]),],'label' => 'Contraseña',]);}public function configureOptions(OptionsResolver $resolver): void{$resolver->setDefaults(['data_class' => User::class,]);}}