1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the CMS Kernel package. |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2016-present LIN3S <[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 LIN3S\CMSKernel\Infrastructure\Symfony\Bundle; |
13
|
|
|
|
14
|
|
|
use LIN3S\CMSKernel\Infrastructure\Symfony\Bundle\DependencyInjection\Compiler\ClassMapTemplateFactoryPass; |
15
|
|
|
use LIN3S\CMSKernel\Infrastructure\Symfony\Bundle\DependencyInjection\Compiler\DoctrineORMCustomTypesPass; |
16
|
|
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
17
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
18
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Beñat Espiña <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
class Lin3sCmsKernelBundle extends Bundle |
24
|
|
|
{ |
25
|
|
|
public function build(ContainerBuilder $container) |
26
|
|
|
{ |
27
|
|
|
$container->addCompilerPass(new ClassMapTemplateFactoryPass(), PassConfig::TYPE_OPTIMIZE); |
28
|
|
|
$container->addCompilerPass(new DoctrineORMCustomTypesPass(), PassConfig::TYPE_OPTIMIZE); |
29
|
|
|
|
30
|
|
|
$container->loadFromExtension('doctrine', [ |
31
|
|
|
'orm' => [ |
32
|
|
|
'mappings' => [ |
33
|
|
|
'Lin3sCmsKernelMenu' => [ |
34
|
|
|
'type' => 'xml', |
35
|
|
|
'is_bundle' => false, |
36
|
|
|
'dir' => $this->doctrineORMBasePath() . '/Menu/Mapping/', |
37
|
|
|
'prefix' => 'LIN3S\CMSKernel\Domain\Model\Menu', |
38
|
|
|
], |
39
|
|
|
'Lin3sCmsKernelPage' => [ |
40
|
|
|
'type' => 'xml', |
41
|
|
|
'is_bundle' => false, |
42
|
|
|
'dir' => $this->doctrineORMBasePath() . '/Page/Mapping/', |
43
|
|
|
'prefix' => 'LIN3S\CMSKernel\Domain\Model\Page', |
44
|
|
|
], |
45
|
|
|
'Lin3sCmsKernelSeo' => [ |
46
|
|
|
'type' => 'xml', |
47
|
|
|
'is_bundle' => false, |
48
|
|
|
'dir' => $this->doctrineORMBasePath() . '/Seo/Mapping/', |
49
|
|
|
'prefix' => 'LIN3S\CMSKernel\Domain\Model\Seo', |
50
|
|
|
], |
51
|
|
|
'Lin3sCmsKernelTranslation' => [ |
52
|
|
|
'type' => 'xml', |
53
|
|
|
'is_bundle' => false, |
54
|
|
|
'dir' => $this->doctrineORMBasePath() . '/Translation/Mapping/', |
55
|
|
|
'prefix' => 'LIN3S\CMSKernel\Domain\Model\Translation', |
56
|
|
|
], |
57
|
|
|
], |
58
|
|
|
], |
59
|
|
|
]); |
60
|
|
|
|
61
|
|
|
$container->loadFromExtension('twig', [ |
62
|
|
|
'paths' => [ |
63
|
|
|
$this->twigBasePath(), |
64
|
|
|
], |
65
|
|
|
'form_themes' => [ |
66
|
|
|
'Form/file.html.twig', |
67
|
|
|
'Form/template_selector.html.twig', |
68
|
|
|
'Form/wysiwyg.html.twig', |
69
|
|
|
'Form/menu_tree.html.twig', |
70
|
|
|
], |
71
|
|
|
]); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
private function doctrineORMBasePath() |
75
|
|
|
{ |
76
|
|
|
return $this->basePath() . '/../../Persistence/Doctrine/ORM'; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
private function twigBasePath() |
80
|
|
|
{ |
81
|
|
|
return $this->basePath() . '/../../Ui/Templates/Twig'; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
private function basePath() |
85
|
|
|
{ |
86
|
|
|
return dirname((new \ReflectionClass(self::class))->getFileName()); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|