DepartmentType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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