CustomEntityType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 6 1
A getName() 0 4 1
1
<?php
2
3
namespace Pim\Bundle\CustomEntityBundle\Form\Type;
4
5
use Pim\Bundle\EnrichBundle\Form\Subscriber\DisableFieldSubscriber;
6
use Symfony\Component\Form\AbstractType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
9
/**
10
 * This generic form must be extended by all custom entities.
11
 * It natively provides a read-only code field and can be used
12
 * independently.
13
 *
14
 * @author Rémy Bétus <[email protected]>
15
 */
16
class CustomEntityType extends AbstractType
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function buildForm(FormBuilderInterface $builder, array $options)
22
    {
23
        $builder
24
            ->add('code')
25
            ->addEventSubscriber(new DisableFieldSubscriber('code'));
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getName()
32
    {
33
        return 'pim_custom_entity';
34
    }
35
}
36