1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the core-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
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 WBW\Bundle\CoreBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
15
|
|
|
use Symfony\Component\Config\FileLocator; |
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
17
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
18
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Core extension. |
22
|
|
|
* |
23
|
|
|
* @author webeweb <https://github.com/webeweb/> |
24
|
|
|
* @package WBW\Bundle\CoreBundle\DependencyInjection |
25
|
|
|
*/ |
26
|
|
|
class WBWCoreExtension extends Extension { |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritDoc} |
30
|
|
|
*/ |
31
|
|
|
public function load(array $configs, ContainerBuilder $container) { |
32
|
|
|
|
33
|
|
|
$fileLocator = new FileLocator(__DIR__ . "/../Resources/config"); |
34
|
|
|
|
35
|
|
|
$serviceLoader = new YamlFileLoader($container, $fileLocator); |
36
|
|
|
$serviceLoader->load("services.yml"); |
37
|
|
|
|
38
|
|
|
/** @var ConfigurationInterface $configuration */ |
39
|
|
|
$configuration = $this->getConfiguration($configs, $container); |
40
|
|
|
|
41
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
42
|
|
|
|
43
|
|
|
if (true === $config["commands"]) { |
44
|
|
|
$serviceLoader->load("commands.yml"); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
if (true === $config["event_listeners"]) { |
48
|
|
|
$serviceLoader->load("event_listeners.yml"); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
if (true === $config["providers"]) { |
52
|
|
|
$serviceLoader->load("providers.yml"); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
if (true === $config["security_event_listener"]) { |
56
|
|
|
$serviceLoader->load("services/security_event_listener.yml"); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
if (true === $config["twig"]) { |
60
|
|
|
$serviceLoader->load("twig.yml"); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|