Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 80 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ModeleAnalyseType | |
0.00% |
0 / 80 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
buildForm | |
0.00% |
0 / 72 |
|
0.00% |
0 / 1 |
20 | |||
configureOptions | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace App\Domain\AIPD\Form\Type; |
6 | |
7 | use App\Domain\AIPD\Model\ModeleAnalyse; |
8 | use Symfony\Component\Form\AbstractType; |
9 | use Symfony\Component\Form\Extension\Core\Type\CollectionType; |
10 | use Symfony\Component\Form\Extension\Core\Type\TextType; |
11 | use Symfony\Component\Form\FormBuilderInterface; |
12 | use Symfony\Component\OptionsResolver\OptionsResolver; |
13 | use Symfony\Component\Validator\Constraints\Valid; |
14 | |
15 | class ModeleAnalyseType extends AbstractType |
16 | { |
17 | public function buildForm(FormBuilderInterface $builder, array $options) |
18 | { |
19 | switch ($options['flow_step']) { |
20 | case 1: |
21 | $builder |
22 | ->add('nom', TextType::class, [ |
23 | 'label' => 'aipd.modele_analyse.label.name', |
24 | 'required' => true, |
25 | 'attr' => [ |
26 | 'maxlength' => 255, |
27 | ], |
28 | 'purify_html' => true, |
29 | ]) |
30 | ->add('description', TextType::class, [ |
31 | 'label' => 'aipd.modele_analyse.label.description', |
32 | 'required' => true, |
33 | 'attr' => [ |
34 | 'maxlength' => 255, |
35 | ], |
36 | 'purify_html' => true, |
37 | ]) |
38 | ->add('labelAmeliorationPrevue', TextType::class, [ |
39 | 'label' => 'aipd.modele_analyse.label.amelioration_prevue', |
40 | 'required' => true, |
41 | 'attr' => [ |
42 | 'maxlength' => 255, |
43 | ], |
44 | 'purify_html' => true, |
45 | ]) |
46 | ->add('labelInsatisfaisant', TextType::class, [ |
47 | 'label' => 'aipd.modele_analyse.label.amelioration_insatisfaisant', |
48 | 'required' => true, |
49 | 'attr' => [ |
50 | 'maxlength' => 255, |
51 | ], |
52 | 'purify_html' => true, |
53 | ]) |
54 | ->add('labelSatisfaisant', TextType::class, [ |
55 | 'label' => 'aipd.modele_analyse.label.amelioration_satisfaisant', |
56 | 'required' => true, |
57 | 'attr' => [ |
58 | 'maxlength' => 255, |
59 | ], |
60 | 'purify_html' => true, |
61 | ]) |
62 | ->add('criterePrincipeFondamentaux', CollectionType::class, [ |
63 | 'entry_type' => CriterePrincipeFondamentalType::class, |
64 | 'required' => true, |
65 | 'constraints' => [ |
66 | new Valid([ |
67 | 'groups' => ['default'], |
68 | ]), |
69 | ], |
70 | ]) |
71 | ; |
72 | break; |
73 | case 2: |
74 | $builder |
75 | ->add('questionConformites', CollectionType::class, [ |
76 | 'entry_type' => ModeleQuestionConformiteType::class, |
77 | ]) |
78 | ; |
79 | break; |
80 | case 3: |
81 | $builder |
82 | ->add('scenarioMenaces', CollectionType::class, [ |
83 | 'entry_type' => ModeleScenarioMenaceType::class, |
84 | 'required' => true, |
85 | 'allow_add' => true, |
86 | 'allow_delete' => true, |
87 | 'by_reference' => false, |
88 | ]) |
89 | ; |
90 | break; |
91 | } |
92 | } |
93 | |
94 | /** |
95 | * Provide type options. |
96 | */ |
97 | public function configureOptions(OptionsResolver $resolver) |
98 | { |
99 | $resolver |
100 | ->setDefaults([ |
101 | 'data_class' => ModeleAnalyse::class, |
102 | 'validation_groups' => [ |
103 | 'default', |
104 | 'aipd', |
105 | ], |
106 | ]); |
107 | } |
108 | } |