Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
SurveyAnswerType | |
0.00% |
0 / 16 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
buildForm | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
configureOptions | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * This file is part of the MADIS - RGPD Management application. |
5 | * |
6 | * @copyright Copyright (c) 2018-2019 Soluris - Solutions Numériques Territoriales Innovantes |
7 | * |
8 | * This program is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU Affero General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU Affero General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU Affero General Public License |
19 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
20 | */ |
21 | |
22 | declare(strict_types=1); |
23 | |
24 | namespace App\Domain\Maturity\Form\Type; |
25 | |
26 | use App\Domain\Maturity\Model; |
27 | use Symfony\Bridge\Doctrine\Form\Type\EntityType; |
28 | use Symfony\Component\Form\AbstractType; |
29 | use Symfony\Component\Form\FormBuilderInterface; |
30 | use Symfony\Component\OptionsResolver\OptionsResolver; |
31 | use Symfony\Component\Security\Core\Security; |
32 | |
33 | class SurveyAnswerType extends AbstractType |
34 | { |
35 | protected Security $security; |
36 | |
37 | public function __construct(Security $security) |
38 | { |
39 | $this->security = $security; |
40 | } |
41 | |
42 | /** |
43 | * Build type form. |
44 | */ |
45 | public function buildForm(FormBuilderInterface $builder, array $options) |
46 | { |
47 | $builder |
48 | ->add('answer', EntityType::class, [ |
49 | 'multiple' => true, |
50 | 'class' => Model\Answer::class, |
51 | 'choice_label' => 'name', |
52 | ]) |
53 | ; |
54 | } |
55 | |
56 | /** |
57 | * Provide type options. |
58 | */ |
59 | public function configureOptions(OptionsResolver $resolver) |
60 | { |
61 | $resolver |
62 | ->setDefaults([ |
63 | 'data_class' => Model\Answer::class, |
64 | 'validation_groups' => [ |
65 | 'default', |
66 | 'answer', |
67 | ], |
68 | ]); |
69 | } |
70 | } |