1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Superdesk Web Publisher Core Bundle. |
5
|
|
|
* |
6
|
|
|
* Copyright 2015 Sourcefabric z.u. and contributors. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please see the |
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @copyright 2015 Sourcefabric z.ú |
12
|
|
|
* @license http://www.superdesk.org/license |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace SWP\Bundle\CoreBundle\DependencyInjection; |
16
|
|
|
|
17
|
|
|
use SWP\Bundle\StorageBundle\DependencyInjection\Extension\Extension; |
18
|
|
|
use SWP\Bundle\StorageBundle\Drivers; |
19
|
|
|
use Symfony\Component\Config\FileLocator; |
20
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
21
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* This is the class that loads and manages your bundle configuration. |
25
|
|
|
* |
26
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
27
|
|
|
*/ |
28
|
|
|
class SWPCoreExtension extends Extension |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* {@inheritdoc} |
32
|
|
|
*/ |
33
|
|
|
public function load(array $configs, ContainerBuilder $container) |
34
|
|
|
{ |
35
|
|
|
$config = $this->processConfiguration(new Configuration(), $configs); |
36
|
|
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
37
|
|
|
$loader->load('services.yml'); |
38
|
|
|
$loader->load('twig.yml'); |
39
|
|
|
$loader->load('composite_publishing.yml'); |
40
|
|
|
$loader->load('rules.yml'); |
41
|
|
|
$loader->load('form.yml'); |
42
|
|
|
$loader->load('output_channel_adapter.yml'); |
43
|
|
|
$loader->load('websocket.yml'); |
44
|
|
|
$loader->load('commands.yml'); |
45
|
|
|
$this->loadDeviceListener($config, $loader); |
46
|
|
|
|
47
|
|
|
$this->registerStorage(Drivers::DRIVER_DOCTRINE_ORM, $config['persistence']['orm']['classes'], $container); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
private function loadDeviceListener(array $config, Loader\YamlFileLoader $loader) |
51
|
|
|
{ |
52
|
|
|
if ($config['device_listener']['enabled']) { |
53
|
|
|
$loader->load('device_listener.yml'); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|