1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file has been created by developers from BitBag. |
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
6
|
|
|
* You can find more information about us on https://bitbag.io and write us |
7
|
|
|
* an email on [email protected]. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace BitBag\SyliusMolliePlugin\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use SyliusLabs\DoctrineMigrationsExtraBundle\DependencyInjection\Configuration; |
15
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
16
|
|
|
use Symfony\Component\Config\FileLocator; |
17
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
18
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
19
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
20
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
21
|
|
|
|
22
|
|
|
final class BitBagSyliusMollieExtension extends Extension implements PrependExtensionInterface |
23
|
|
|
{ |
24
|
|
|
public function load(array $configs, ContainerBuilder $container): void |
25
|
|
|
{ |
26
|
|
|
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs); |
|
|
|
|
27
|
|
|
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
28
|
|
|
|
29
|
|
|
$loader->load('services.xml'); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function prepend(ContainerBuilder $container): void |
33
|
|
|
{ |
34
|
|
|
if (!$container->hasExtension('doctrine_migrations') || !$container->hasExtension('sylius_labs_doctrine_migrations_extra')) { |
35
|
|
|
return; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
$container->prependExtensionConfig('doctrine_migrations', [ |
39
|
|
|
'migrations_paths' => [ |
40
|
|
|
'BitBag\SyliusMolliePlugin\Migrations' => __DIR__ . '/../Migrations', |
41
|
|
|
], |
42
|
|
|
]); |
43
|
|
|
|
44
|
|
|
$container->prependExtensionConfig('sylius_labs_doctrine_migrations_extra', [ |
45
|
|
|
'migrations' => [ |
46
|
|
|
'BitBag\SyliusMolliePlugin\Migrations' => ['Sylius\Bundle\CoreBundle\Migrations'], |
47
|
|
|
], |
48
|
|
|
]); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface |
52
|
|
|
{ |
53
|
|
|
return new Configuration(); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|