1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Odiseo\SyliusReferralsPlugin\DependencyInjection; |
6
|
|
|
|
7
|
|
|
use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait; |
8
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
9
|
|
|
use Symfony\Component\Config\FileLocator; |
10
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
11
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
12
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
13
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
14
|
|
|
|
15
|
|
|
final class OdiseoSyliusReferralsExtension extends Extension implements PrependExtensionInterface |
16
|
|
|
{ |
17
|
|
|
use PrependDoctrineMigrationsTrait; |
18
|
|
|
|
19
|
|
|
public function load(array $configs, ContainerBuilder $container): void |
20
|
|
|
{ |
21
|
|
|
$this->processConfiguration($this->getConfiguration([], $container), $configs); |
22
|
|
|
|
23
|
|
|
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
24
|
|
|
|
25
|
|
|
$loader->load('services.yaml'); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface |
29
|
|
|
{ |
30
|
|
|
return new Configuration(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function prepend(ContainerBuilder $container): void |
34
|
|
|
{ |
35
|
|
|
$this->prependDoctrineMigrations($container); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
protected function getMigrationsNamespace(): string |
39
|
|
|
{ |
40
|
|
|
return 'Odiseo\SyliusReferralsPlugin\Migrations'; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
protected function getMigrationsDirectory(): string |
44
|
|
|
{ |
45
|
|
|
return '@OdiseoSyliusReferralsPlugin/Migrations'; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
protected function getNamespacesOfMigrationsExecutedBefore(): array |
49
|
|
|
{ |
50
|
|
|
return [ |
51
|
|
|
'Sylius\Bundle\CoreBundle\Migrations', |
52
|
|
|
]; |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|