1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Config\FileLocator; |
6
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
7
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
8
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
9
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class AppExtension |
13
|
|
|
*/ |
14
|
|
|
class AppExtension extends Extension implements PrependExtensionInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* {@inheritdoc} |
18
|
|
|
*/ |
19
|
|
|
public function prepend(ContainerBuilder $container) |
20
|
|
|
{ |
21
|
|
|
$container->prependExtensionConfig('app', [ |
22
|
|
|
'bpm' => [ |
23
|
|
|
'variables' => [ |
24
|
|
|
'api_url' => 'api_url', |
25
|
|
|
'api_user' => 'api_user', |
26
|
|
|
'api_key' => 'api_key', |
27
|
|
|
'service_uuid' => 'service_uuid', |
28
|
|
|
'scenario_uuid' => 'scenario_uuid', |
29
|
|
|
'identity' => 'identity', |
30
|
|
|
'identity_uuid' => 'identity_uuid', |
31
|
|
|
'submission_uuid' => 'submission_uuid', |
32
|
|
|
'start_data' => 'start_data' |
33
|
|
|
] |
34
|
|
|
] |
35
|
|
|
]); |
36
|
|
|
|
37
|
|
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
38
|
|
|
$loader->load('config.yml'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* {@inheritdoc} |
43
|
|
|
*/ |
44
|
|
|
public function load(array $configs, ContainerBuilder $container) |
45
|
|
|
{ |
46
|
|
|
$configuration = new Configuration; |
47
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
48
|
|
|
|
49
|
|
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
50
|
|
|
$loader->load('actions.yml'); |
51
|
|
|
$loader->load('api_filters.yml'); |
52
|
|
|
$loader->load('event_listeners.yml'); |
53
|
|
|
$loader->load('forms.yml'); |
54
|
|
|
$loader->load('services.yml'); |
55
|
|
|
$loader->load('stats.yml'); |
56
|
|
|
$loader->load('tenants.yml'); |
57
|
|
|
|
58
|
|
|
// @todo Move this config -> parameters logic to a common trait in the config component bridge |
59
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.api_url', $config['bpm']['variables']['api_url']); |
60
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.api_user', $config['bpm']['variables']['api_user']); |
61
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.api_key', $config['bpm']['variables']['api_key']); |
62
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.service_uuid', $config['bpm']['variables']['service_uuid']); |
63
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.scenario_uuid', $config['bpm']['variables']['scenario_uuid']); |
64
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.identity', $config['bpm']['variables']['identity']); |
65
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.identity_uuid', $config['bpm']['variables']['identity_uuid']); |
66
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.submission_uuid', $config['bpm']['variables']['submission_uuid']); |
67
|
|
|
$container->setParameter('ds_config.configs.app.bpm.variables.start_data', $config['bpm']['variables']['start_data']); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|