Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
26 / 26 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| GuestType | |
100.00% |
26 / 26 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| buildForm | |
100.00% |
23 / 23 |
|
100.00% |
1 / 1 |
1 | |||
| configureOptions | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Form; |
| 4 | |
| 5 | use App\Entity\User; |
| 6 | use Symfony\Component\Form\AbstractType; |
| 7 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
| 8 | use Symfony\Component\Form\Extension\Core\Type\EmailType; |
| 9 | use Symfony\Component\Form\Extension\Core\Type\PasswordType; |
| 10 | use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
| 11 | use Symfony\Component\Form\Extension\Core\Type\TextType; |
| 12 | use Symfony\Component\Form\FormBuilderInterface; |
| 13 | use Symfony\Component\OptionsResolver\OptionsResolver; |
| 14 | |
| 15 | /** |
| 16 | * @extends AbstractType<User> |
| 17 | */ |
| 18 | class GuestType extends AbstractType |
| 19 | { |
| 20 | public function buildForm(FormBuilderInterface $builder, array $options): void |
| 21 | { |
| 22 | $builder |
| 23 | ->add('name', TextType::class, [ |
| 24 | 'label' => 'Nom', |
| 25 | 'required' => true, |
| 26 | ]) |
| 27 | ->add('description', TextareaType::class, [ |
| 28 | 'label' => 'Description', |
| 29 | 'required' => false, |
| 30 | ]) |
| 31 | ->add('email', EmailType::class, [ |
| 32 | 'label' => 'Email', |
| 33 | 'required' => true, |
| 34 | ]) |
| 35 | ->add('plainPassword', PasswordType::class, [ |
| 36 | 'label' => 'Mot de passe', |
| 37 | 'mapped' => false, |
| 38 | 'required' => true, |
| 39 | ]) |
| 40 | ->add('admin', CheckboxType::class, [ |
| 41 | 'label' => 'Accès Admin', |
| 42 | 'required' => false, |
| 43 | ]) |
| 44 | ; |
| 45 | } |
| 46 | |
| 47 | public function configureOptions(OptionsResolver $resolver): void |
| 48 | { |
| 49 | $resolver->setDefaults([ |
| 50 | 'data_class' => User::class, |
| 51 | ]); |
| 52 | } |
| 53 | } |