Completed
Pull Request — master (#367)
by Wouter
02:34
created

SonataDoctrinePHPCRAdminBundle::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sonata project.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrinePHPCRAdminBundle;
13
14
use Sonata\CoreBundle\Form\FormHelper;
15
use Sonata\DoctrinePHPCRAdminBundle\DependencyInjection\Compiler\AddGuesserCompilerPass;
16
use Sonata\DoctrinePHPCRAdminBundle\DependencyInjection\Compiler\AddTemplatesCompilerPass;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\HttpKernel\Bundle\Bundle;
19
20
class SonataDoctrinePHPCRAdminBundle extends Bundle
21
{
22
    /**
23
     * @param ContainerBuilder $container
24
     */
25
    public function build(ContainerBuilder $container)
26
    {
27
        $this->registerFormMapping();
28
29
        $container->addCompilerPass(new AddGuesserCompilerPass());
30
        $container->addCompilerPass(new AddTemplatesCompilerPass());
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function boot()
37
    {
38
        $this->registerFormMapping();
39
    }
40
41
    private function registerFormMapping()
42
    {
43
        FormHelper::registerFormTypeMapping(array(
44
            'doctrine_phpcr_type_filter_choice' => 'Sonata\DoctrinePHPCRAdminBundle\Form\Type\Filter\ChoiceType',
45
            'choice_field_mask'                 => 'Sonata\DoctrinePHPCRAdminBundle\Form\Type\ChoiceFieldMaskType',
46
            'doctrine_phpcr_odm_tree_manager'   => 'Sonata\DoctrinePHPCRAdminBundle\Form\Type\TreeManagerType',
47
            'doctrine_phpcr_odm_tree'           => 'Sonata\DoctrinePHPCRAdminBundle\Form\Type\TreeModelType',
48
        ));
49
    }
50
}
51