DepartmentType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureOptions() 0 4 1
A buildForm() 0 9 1
1
<?php
2
3
namespace App\Form;
4
5
use App\Entity\Department;
6
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
7
use Symfony\Component\Form\AbstractType;
8
use Symfony\Component\Form\FormBuilderInterface;
9
use Symfony\Component\OptionsResolver\OptionsResolver;
10
11
class DepartmentType extends AbstractType
12
{
13
    public function buildForm(FormBuilderInterface $builder, array $options)
14
    {
15
        $builder
16
            ->add('name', EntityType::class, [
17
                'class' => Department::class,
18
                'label' => 'Département',
19
                'choice_label' => 'name',
20
                'multiple' => false,
21
                'placeholder' => 'Choisissez un département'
22
            ])
23
        ;
24
    }
25
26
    public function configureOptions(OptionsResolver $resolver)
27
    {
28
        $resolver->setDefaults([
29
            'data_class' => Department::class,
30
        ]);
31
    }
32
}
33