|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Obblm\Core\Form\Coach; |
|
4
|
|
|
|
|
5
|
|
|
use Obblm\Core\Entity\Coach; |
|
6
|
|
|
use Symfony\Component\Form\AbstractType; |
|
7
|
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
|
8
|
|
|
use Symfony\Component\Form\Extension\Core\Type\EmailType; |
|
9
|
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType; |
|
10
|
|
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType; |
|
11
|
|
|
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; |
|
12
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
13
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
|
14
|
|
|
|
|
15
|
|
|
class EditUserForm extends AbstractType |
|
16
|
|
|
{ |
|
17
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
|
18
|
|
|
{ |
|
19
|
|
|
$builder->add('username', HiddenType::class) |
|
20
|
|
|
->add('firstName') |
|
21
|
|
|
->add('lastName') |
|
22
|
|
|
->add('email') |
|
23
|
|
|
->add('locale', ChoiceType::class, [ |
|
24
|
|
|
'choices' => ['Français' => 'fr', 'English' => 'en'] |
|
25
|
|
|
]) |
|
26
|
|
|
->add('plainPassword', RepeatedType::class, array( |
|
27
|
|
|
'type' => PasswordType::class, |
|
28
|
|
|
'required' => false, |
|
29
|
|
|
'first_options' => array('label' => 'field.password'), |
|
30
|
|
|
'second_options' => array('label' => 'field.password.repeat'), |
|
31
|
|
|
)); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function configureOptions(OptionsResolver $resolver) |
|
35
|
|
|
{ |
|
36
|
|
|
$resolver->setDefaults(array( |
|
37
|
|
|
'data_class' => Coach::class, |
|
38
|
|
|
)); |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|