1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace LaFourchette\AdobeCampaignClientBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
6
|
|
|
use Symfony\Component\DependencyInjection\Definition; |
7
|
|
|
use Symfony\Component\Config\FileLocator; |
8
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
9
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* This is the class that loads and manages your bundle configuration |
13
|
|
|
* |
14
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
15
|
|
|
*/ |
16
|
|
|
class AdobeCampaignClientExtension extends Extension |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* {@inheritDoc} |
20
|
|
|
*/ |
21
|
1 |
|
public function load(array $configs, ContainerBuilder $container) |
22
|
|
|
{ |
23
|
1 |
|
$configuration = new Configuration(); |
24
|
1 |
|
$config = $this->processConfiguration($configuration, $configs); |
25
|
1 |
|
$container->setParameter('adobe_campaign_client.configuration', $config); |
26
|
|
|
|
27
|
1 |
|
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
28
|
1 |
|
$loader->load('services.xml'); |
29
|
|
|
|
30
|
|
|
// Load client services from configuration |
31
|
1 |
|
foreach ($config['schemas'] as $node) { |
32
|
1 |
|
$this->loadClient($container, $node); |
33
|
1 |
|
} |
34
|
1 |
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param ContainerBuilder $container |
38
|
|
|
* @param array $node |
39
|
|
|
*/ |
40
|
1 |
|
protected function loadClient(ContainerBuilder $container, $node) |
41
|
|
|
{ |
42
|
1 |
|
$definitionClient = new Definition('LaFourchette\AdobeCampaignClientBundle\Client\Client', array( |
43
|
1 |
|
$node['schema'] |
44
|
1 |
|
)); |
45
|
1 |
|
$definitionClient->setFactoryService('adobe_campaign_client.creator.client'); |
|
|
|
|
46
|
1 |
|
$definitionClient->setFactoryMethod('create'); |
|
|
|
|
47
|
|
|
|
48
|
1 |
|
$container->setDefinition('adobe_campaign_client.client.' . $node['name'], $definitionClient); |
49
|
1 |
|
} |
50
|
|
|
} |
51
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.