Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
32 / 32 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
RequestAnswerType | |
100.00% |
32 / 32 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
buildForm | |
100.00% |
25 / 25 |
|
100.00% |
1 / 1 |
1 | |||
configureOptions | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 |
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\Registry\Form\Type\Embeddable; |
25 | |
26 | use App\Domain\Registry\Model\Embeddable\RequestAnswer; |
27 | use Knp\DictionaryBundle\Form\Type\DictionaryType; |
28 | use Symfony\Component\Form\AbstractType; |
29 | use Symfony\Component\Form\Extension\Core\Type\DateType; |
30 | use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
31 | use Symfony\Component\Form\FormBuilderInterface; |
32 | use Symfony\Component\OptionsResolver\OptionsResolver; |
33 | |
34 | class RequestAnswerType extends AbstractType |
35 | { |
36 | /** |
37 | * Build type form. |
38 | */ |
39 | public function buildForm(FormBuilderInterface $builder, array $options) |
40 | { |
41 | $builder |
42 | ->add('response', TextareaType::class, [ |
43 | 'label' => 'registry.request.label.answer_response', |
44 | 'required' => false, |
45 | 'attr' => [ |
46 | 'rows' => 4, |
47 | ], |
48 | 'purify_html' => true, |
49 | ]) |
50 | ->add('date', DateType::class, [ |
51 | 'label' => 'registry.request.label.answer_date', |
52 | 'required' => false, |
53 | 'widget' => 'single_text', |
54 | 'format' => 'dd/MM/yyyy', |
55 | 'html5' => false, |
56 | 'attr' => [ |
57 | 'class' => 'datepicker', |
58 | ], |
59 | ]) |
60 | ->add('type', DictionaryType::class, [ |
61 | 'label' => 'registry.request.label.answer_type', |
62 | 'name' => 'registry_request_answer_type', |
63 | 'required' => false, |
64 | ]) |
65 | ; |
66 | } |
67 | |
68 | /** |
69 | * Provide type options. |
70 | */ |
71 | public function configureOptions(OptionsResolver $resolver) |
72 | { |
73 | $resolver |
74 | ->setDefaults([ |
75 | 'data_class' => RequestAnswer::class, |
76 | 'validation_groups' => [ |
77 | 'default', |
78 | ], |
79 | ]); |
80 | } |
81 | } |