1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PiouPiou\RibsAdminBundle\Form; |
4
|
|
|
|
5
|
|
|
use PiouPiou\RibsAdminBundle\Form\Type\UploaderType; |
6
|
|
|
use Symfony\Component\Form\AbstractType; |
7
|
|
|
use Symfony\Component\Form\Extension\Core\Type\EmailType; |
8
|
|
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType; |
9
|
|
|
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; |
10
|
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
11
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType; |
12
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
13
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
14
|
|
|
|
15
|
|
|
class Account extends AbstractType |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @param FormBuilderInterface $builder |
19
|
|
|
* @param array $options |
20
|
|
|
*/ |
21
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
22
|
|
|
{ |
23
|
|
|
$builder |
24
|
|
|
->add('username', TextType::class, [ |
25
|
|
|
'label' => 'Pseudo', |
26
|
|
|
'attr' => [], |
27
|
|
|
'required' => true |
28
|
|
|
]) |
29
|
|
|
->add('email', EmailType::class, [ |
30
|
|
|
'label' => 'E-mail', |
31
|
|
|
'attr' => [], |
32
|
|
|
'required' => true |
33
|
|
|
]) |
34
|
|
|
->add('password', RepeatedType::class, [ |
35
|
|
|
'type' => PasswordType::class, |
36
|
|
|
'invalid_message' => 'The password fields must match', |
37
|
|
|
'required' => false, |
38
|
|
|
'first_options' => [ |
39
|
|
|
'label' => 'Password', |
40
|
|
|
], |
41
|
|
|
'second_options' => [ |
42
|
|
|
'label' => 'Repeat Password', |
43
|
|
|
], |
44
|
|
|
]) |
45
|
|
|
->add('submit', SubmitType::class, [ |
46
|
|
|
'label' => 'Validate', |
47
|
|
|
'attr' => [] |
48
|
|
|
]); |
49
|
|
|
|
50
|
|
|
$builder->add('user', User::class); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param OptionsResolver $resolver |
55
|
|
|
*/ |
56
|
|
|
public function configureOptions(OptionsResolver $resolver) |
57
|
|
|
{ |
58
|
|
|
$resolver->setDefaults([ |
59
|
|
|
'data_class' => \PiouPiou\RibsAdminBundle\Entity\Account::class, |
60
|
|
|
]); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|