BatchType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 36
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 8 1
A configureOptions() 0 10 1
A getBlockPrefix() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Ivoaz ContentEditable bundle.
5
 *
6
 * (c) Ivo Azirjans <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Ivoaz\Bundle\ContentEditableBundle\Form\Type;
13
14
use Ivoaz\Bundle\ContentEditableBundle\Form\Model\Batch;
15
use Symfony\Component\Form\AbstractType;
16
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
17
use Symfony\Component\Form\FormBuilderInterface;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
20
/**
21
 * @author Ivo Azirjans <[email protected]>
22
 */
23
class BatchType extends AbstractType
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public function buildForm(FormBuilderInterface $builder, array $options)
29
    {
30 1
        $builder->add(
31 1
            'contents',
32 1
            CollectionType::class,
33 1
            ['entry_type' => BatchContentType::class, 'allow_add' => true, 'allow_delete' => true]
34 1
        );
35 1
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    public function configureOptions(OptionsResolver $resolver)
41
    {
42 1
        $resolver->setDefaults(
43
            [
44 1
                'data_class'      => Batch::class,
45 1
                'csrf_protection' => false,
46 1
                'method'          => 'POST',
47
            ]
48 1
        );
49 1
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    public function getBlockPrefix()
55
    {
56 1
        return '';
57
    }
58
}
59