Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
51 / 51 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
RequestApplicantType | |
100.00% |
51 / 51 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
buildForm | |
100.00% |
44 / 44 |
|
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\RequestApplicant; |
27 | use Knp\DictionaryBundle\Form\Type\DictionaryType; |
28 | use Symfony\Component\Form\AbstractType; |
29 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
30 | use Symfony\Component\Form\Extension\Core\Type\EmailType; |
31 | use Symfony\Component\Form\Extension\Core\Type\TextType; |
32 | use Symfony\Component\Form\FormBuilderInterface; |
33 | use Symfony\Component\OptionsResolver\OptionsResolver; |
34 | |
35 | class RequestApplicantType extends AbstractType |
36 | { |
37 | /** |
38 | * Build type form. |
39 | */ |
40 | public function buildForm(FormBuilderInterface $builder, array $options) |
41 | { |
42 | $builder |
43 | ->add('civility', DictionaryType::class, [ |
44 | 'label' => 'global.label.contact.civility', |
45 | 'required' => true, |
46 | 'name' => 'registry_request_civility', |
47 | ]) |
48 | ->add('firstName', TextType::class, [ |
49 | 'label' => 'global.label.contact.first_name', |
50 | 'required' => true, |
51 | 'attr' => [ |
52 | 'maxlength' => 255, |
53 | ], |
54 | 'purify_html' => true, |
55 | ]) |
56 | ->add('lastName', TextType::class, [ |
57 | 'label' => 'global.label.contact.last_name', |
58 | 'required' => true, |
59 | 'attr' => [ |
60 | 'maxlength' => 255, |
61 | ], |
62 | 'purify_html' => true, |
63 | ]) |
64 | ->add('address', TextType::class, [ |
65 | 'label' => 'global.label.address.line_one', |
66 | 'required' => false, |
67 | 'attr' => [ |
68 | 'maxlength' => 255, |
69 | ], |
70 | 'purify_html' => true, |
71 | ]) |
72 | ->add('mail', EmailType::class, [ |
73 | 'label' => 'global.label.contact.email', |
74 | 'required' => false, |
75 | ]) |
76 | ->add('phoneNumber', TextType::class, [ |
77 | 'label' => 'global.label.contact.phone_number', |
78 | 'required' => false, |
79 | 'purify_html' => true, |
80 | ]) |
81 | ->add('concernedPeople', CheckboxType::class, [ |
82 | 'label' => 'registry.request.label.is_concerned_people', |
83 | 'required' => false, |
84 | ]) |
85 | ; |
86 | } |
87 | |
88 | /** |
89 | * Provide type options. |
90 | */ |
91 | public function configureOptions(OptionsResolver $resolver) |
92 | { |
93 | $resolver |
94 | ->setDefaults([ |
95 | 'data_class' => RequestApplicant::class, |
96 | 'validation_groups' => [ |
97 | 'default', |
98 | ], |
99 | ]); |
100 | } |
101 | } |