Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 50 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
AnalyseScenarioMenaceType | |
0.00% |
0 / 50 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
buildForm | |
0.00% |
0 / 47 |
|
0.00% |
0 / 1 |
6 | |||
configureOptions | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace App\Domain\AIPD\Form\Type; |
4 | |
5 | use App\Domain\AIPD\Model\AnalyseScenarioMenace; |
6 | use Knp\DictionaryBundle\Form\Type\DictionaryType; |
7 | use Symfony\Component\Form\AbstractType; |
8 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
9 | use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
10 | use Symfony\Component\Form\FormBuilderInterface; |
11 | use Symfony\Component\Form\FormEvent; |
12 | use Symfony\Component\Form\FormEvents; |
13 | use Symfony\Component\OptionsResolver\OptionsResolver; |
14 | |
15 | class AnalyseScenarioMenaceType extends AbstractType |
16 | { |
17 | public function buildForm(FormBuilderInterface $builder, array $options) |
18 | { |
19 | $builder->addEventListener( |
20 | FormEvents::PRE_SET_DATA, |
21 | function (FormEvent $event) { |
22 | $form = $event->getForm(); |
23 | if ($event->getData()->isCanDicBeModified()) { |
24 | $form |
25 | ->add('isDisponibilite', CheckboxType::class, [ |
26 | 'required' => false, |
27 | 'label' => false, |
28 | ]) |
29 | ->add('isIntegrite', CheckboxType::class, [ |
30 | 'required' => false, |
31 | 'label' => false, |
32 | ]) |
33 | ->add('isConfidentialite', CheckboxType::class, [ |
34 | 'required' => false, |
35 | 'label' => false, |
36 | ]) |
37 | ; |
38 | } |
39 | }); |
40 | $builder |
41 | ->add('vraisemblance', DictionaryType::class, [ |
42 | 'name' => 'vraisemblance_gravite', |
43 | 'required' => true, |
44 | 'label' => false, |
45 | 'attr' => [ |
46 | 'class' => 'vraisemblance-dropdown', |
47 | ], |
48 | ]) |
49 | ->add('gravite', DictionaryType::class, [ |
50 | 'name' => 'vraisemblance_gravite', |
51 | 'required' => true, |
52 | 'label' => false, |
53 | 'attr' => [ |
54 | 'class' => 'gravite-dropdown', |
55 | ], |
56 | ]) |
57 | ->add('precisions', TextareaType::class, [ |
58 | 'required' => false, |
59 | 'attr' => [ |
60 | 'maxlength' => 1000, |
61 | 'rows' => 1, |
62 | 'class' => 'textareaheight', |
63 | ], |
64 | 'purify_html' => true, |
65 | ]) |
66 | ; |
67 | } |
68 | |
69 | public function configureOptions(OptionsResolver $resolver) |
70 | { |
71 | $resolver->setDefaults([ |
72 | 'data_class' => AnalyseScenarioMenace::class, |
73 | ]); |
74 | } |
75 | } |