|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Knowledge Base package. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (c) 2015 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\KnowledgeBaseBundle\DependencyInjection\Compiler; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
|
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\Definition; |
|
17
|
|
|
use Symfony\Component\DependencyInjection\Reference; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Class ConfigurationCompilerPass. |
|
21
|
|
|
* |
|
22
|
|
|
* Loads config from parameters and adds definitions in the container for template and configuration as |
|
23
|
|
|
* 'lin3s_knowledge_base.template' and 'lin3s_knowledge_base.configuration' respectively. |
|
24
|
|
|
* |
|
25
|
|
|
* @author Gorka Laucirica <[email protected]> |
|
26
|
|
|
*/ |
|
27
|
|
|
class ConfigurationCompilerPass implements CompilerPassInterface |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* {@inheritdoc} |
|
31
|
|
|
*/ |
|
32
|
|
|
public function process(ContainerBuilder $container) |
|
33
|
|
|
{ |
|
34
|
|
|
$configParameters = $container->getParameter('lin3s_knowledge_base.configuration_parameters'); |
|
35
|
|
|
|
|
36
|
|
|
$container->setDefinition('lin3s_knowledge_base.template', new Definition( |
|
37
|
|
|
$configParameters['template'] |
|
38
|
|
|
)); |
|
39
|
|
|
|
|
40
|
|
|
$config = new Definition('LIN3S\KnowledgeBase\Configuration', [ |
|
41
|
|
|
$configParameters['docs_path'], |
|
42
|
|
|
$configParameters['build_path'], |
|
43
|
|
|
new Reference('lin3s_knowledge_base.template'), |
|
44
|
|
|
$configParameters['assets_base_url'] |
|
45
|
|
|
]); |
|
46
|
|
|
$container->setDefinition('lin3s_knowledge_base.configuration', $config); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|