]> Raphaƫl G. Git Repositories - userbundle/blob - Form/RecoverMailType.php
Add classname alias to avoid argument binding failure
[userbundle] / Form / RecoverMailType.php
1 <?php
2
3 namespace Rapsys\UserBundle\Form;
4
5 use Symfony\Component\Form\AbstractType;
6 use Symfony\Component\Form\FormBuilderInterface;
7 use Symfony\Component\OptionsResolver\OptionsResolver;
8 use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
9 use Symfony\Component\Form\Extension\Core\Type\PasswordType;
10 use Symfony\Component\Form\Extension\Core\Type\SubmitType;
11 use Symfony\Component\Validator\Constraints\NotBlank;
12
13 class RecoverMailType extends AbstractType {
14 /**
15 * {@inheritdoc}
16 */
17 public function buildForm(FormBuilderInterface $builder, array $options) {
18 return $builder
19 ->add('password', RepeatedType::class, ['type' => PasswordType::class, 'invalid_message' => 'The password and confirmation must match', 'first_options' => ['attr' => ['placeholder' => 'Your password'], 'label' => 'Password'], 'second_options' => ['attr' => ['placeholder' => 'Your password confirmation'], 'label' => 'Confirm password'], 'options' => ['constraints' => [new NotBlank(['message' => 'Please provide your password'])]]])
20 ->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]);
21 }
22
23 /**
24 * {@inheritdoc}
25 */
26 public function configureOptions(OptionsResolver $resolver) {
27 $resolver->setDefaults(['error_bubbling' => true]);
28 }
29
30 /**
31 * {@inheritdoc}
32 */
33 public function getName() {
34 return 'rapsys_user_recover_mail';
35 }
36 }