Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
ReponseDictionaryType | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
configureOptions | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
setDefaultOptions | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getParent | |
0.00% |
0 / 1 |
|
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\Dictionary\ReponseMesureProtectionDictionary; |
8 | use Symfony\Component\Form\AbstractType; |
9 | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
10 | use Symfony\Component\OptionsResolver\Options; |
11 | use Symfony\Component\OptionsResolver\OptionsResolver; |
12 | |
13 | class ReponseDictionaryType extends AbstractType |
14 | { |
15 | public function configureOptions(OptionsResolver $resolver): void |
16 | { |
17 | $resolver->setRequired('aipd'); |
18 | $choices = function (Options $options) { |
19 | $choices = (new ReponseMesureProtectionDictionary($options['aipd']))->getValues(); |
20 | |
21 | return array_flip($choices); |
22 | }; |
23 | |
24 | $resolver |
25 | ->setDefault('choices', $choices) |
26 | ; |
27 | } |
28 | |
29 | public function setDefaultOptions(OptionsResolver $resolver) |
30 | { |
31 | $resolver->setDefaults([ |
32 | // default form options |
33 | 'aipd' => null, |
34 | ]); |
35 | } |
36 | |
37 | public function getParent() |
38 | { |
39 | return ChoiceType::class; |
40 | } |
41 | } |