Completed
Push — master ( 5a2c46...47cba7 )
by Jarek
11s
created

DTOFormElement   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 34
rs 10
c 2
b 0
f 0
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\FixturesBundle\Admin;
11
12
use FSi\Bundle\AdminBundle\Doctrine\Admin\FormElement;
13
use FSi\Bundle\AdminBundle\Form\TypeSolver;
14
use Symfony\Component\Form\FormFactoryInterface;
15
16
class DTOFormElement extends FormElement
17
{
18
    public function getClassName()
19
    {
20
        return 'FSi\FixturesBundle\DTO\Model';
21
    }
22
23
    public function getId()
24
    {
25
        return 'dto_form';
26
    }
27
28
    public function save($object)
29
    {
30
    }
31
32
    protected function initForm(FormFactoryInterface $factory, $data = null)
33
    {
34
        $builder = $factory->createNamedBuilder(
35
            'dto_form',
36
            TypeSolver::getFormType('Symfony\Component\Form\Extension\Core\Type\FormType', 'form'),
37
            $data,
38
            ['data_class' => $this->getClassName()]
39
        );
40
41
        $builder->add(
42
            'email',
43
            TypeSolver::getFormType('Symfony\Component\Form\Extension\Core\Type\EmailType', 'email'),
44
            ['label' => 'admin.email']
45
        );
46
47
        return $builder->getForm();
48
    }
49
}
50