Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
35 / 35 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
EvaluationType | |
100.00% |
35 / 35 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
buildForm | |
100.00% |
28 / 28 |
|
100.00% |
1 / 1 |
1 | |||
configureOptions | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace App\Domain\Registry\Form\Type\ConformiteOrganisation; |
4 | |
5 | use App\Domain\Registry\Model\ConformiteOrganisation\Evaluation; |
6 | use Symfony\Component\Form\AbstractType; |
7 | use Symfony\Component\Form\Extension\Core\Type\CollectionType; |
8 | use Symfony\Component\Form\Extension\Core\Type\DateType; |
9 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
10 | use Symfony\Component\Form\FormBuilderInterface; |
11 | use Symfony\Component\OptionsResolver\OptionsResolver; |
12 | |
13 | class EvaluationType extends AbstractType |
14 | { |
15 | /** |
16 | * Build type form. |
17 | */ |
18 | public function buildForm(FormBuilderInterface $builder, array $options) |
19 | { |
20 | $builder |
21 | ->add('date', DateType::class, [ |
22 | 'label' => 'registry.conformite_organisation.label.date', |
23 | 'required' => true, |
24 | 'widget' => 'single_text', |
25 | 'format' => 'dd/MM/yyyy', |
26 | 'html5' => false, |
27 | 'attr' => [ |
28 | 'class' => 'datepicker', |
29 | ], |
30 | ]) |
31 | ->add('participants', CollectionType::class, [ |
32 | 'entry_type' => ParticipantType::class, |
33 | 'allow_add' => true, |
34 | 'allow_delete' => true, |
35 | 'by_reference' => false, |
36 | ]) |
37 | ->add('conformites', CollectionType::class, [ |
38 | 'entry_type' => ConformiteType::class, |
39 | 'by_reference' => false, |
40 | ]) |
41 | ->add('save', SubmitType::class, [ |
42 | 'row_attr' => ['class' => 'btn'], |
43 | ]) |
44 | ->add('saveDraft', SubmitType::class, [ |
45 | 'validation_groups' => false, |
46 | ]) |
47 | ; |
48 | } |
49 | |
50 | /** |
51 | * Provide type options. |
52 | */ |
53 | public function configureOptions(OptionsResolver $resolver) |
54 | { |
55 | $resolver |
56 | ->setDefaults([ |
57 | 'data_class' => Evaluation::class, |
58 | 'validation_groups' => [ |
59 | 'default', |
60 | ], |
61 | ]); |
62 | } |
63 | } |