1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the SaasProviderBundle package. |
5
|
|
|
* (c) Fluxter <http://fluxter.net/> |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Fluxter\SaasProviderBundle\DependencyInjection; |
11
|
|
|
|
12
|
|
|
use Symfony\Component\Config\FileLocator; |
13
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
14
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
15
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
16
|
|
|
|
17
|
|
|
class SaasProviderExtension extends Extension |
18
|
|
|
{ |
19
|
|
|
public function load(array $configs, ContainerBuilder $container) |
20
|
|
|
{ |
21
|
|
|
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config')); |
22
|
|
|
$loader->load('services.xml'); |
23
|
|
|
|
24
|
|
|
$configuration = new Configuration(); |
25
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
26
|
|
|
|
27
|
|
|
/* |
28
|
|
|
$definition = $container->getDefinition(SaasProviderServiceInterface::class); |
29
|
|
|
$definition->replaceArgument('client_entity', $config['client_entity']); |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
$globalUrl = array_key_exists('global_url', $config) ? $config['global_url'] : null; |
33
|
|
|
if (null != $globalUrl) { |
34
|
|
|
$container->setParameter('saas_provider.global_url', $config['global_url']); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
$container->setParameter('saas_provider.client_entity', $config['client_entity']); |
38
|
|
|
$container->setParameter('saas_provider.apikey', $config['apikey']); |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|