Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ImportModeleType | |
0.00% |
0 / 17 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
buildForm | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace App\Domain\Maturity\Form\Type; |
6 | |
7 | use Symfony\Component\Form\AbstractType; |
8 | use Symfony\Component\Form\Extension\Core\Type\FileType; |
9 | use Symfony\Component\Form\FormBuilderInterface; |
10 | use Symfony\Component\Validator\Constraints\File; |
11 | |
12 | class ImportModeleType extends AbstractType |
13 | { |
14 | protected string $maxSize; |
15 | |
16 | public function __construct(string $maxSize) |
17 | { |
18 | $this->maxSize = $maxSize; |
19 | } |
20 | |
21 | public function buildForm(FormBuilderInterface $builder, array $options) |
22 | { |
23 | $builder |
24 | ->add('file', FileType::class, [ |
25 | 'required' => true, |
26 | 'label' => 'global.label.import_xml', |
27 | 'constraints' => [ |
28 | new File([ |
29 | 'maxSize' => $this->maxSize, |
30 | 'mimeTypes' => [ |
31 | 'application/xml', |
32 | 'text/xml', |
33 | ], |
34 | 'mimeTypesMessage' => 'referentiel_validator.import.not_xml', |
35 | ]), |
36 | ], |
37 | ]) |
38 | ; |
39 | } |
40 | } |