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