1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace BitBag\SyliusWishlistPlugin\DependencyInjection; |
6
|
|
|
|
7
|
|
|
use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait; |
8
|
|
|
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension; |
9
|
|
|
use Symfony\Component\Config\FileLocator; |
10
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
11
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
12
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
13
|
|
|
|
14
|
|
|
final class BitBagSyliusWishlistExtension extends AbstractResourceExtension implements PrependExtensionInterface |
15
|
|
|
{ |
16
|
|
|
use PrependDoctrineMigrationsTrait; |
17
|
|
|
|
18
|
|
|
public function load(array $config, ContainerBuilder $container): void |
19
|
|
|
{ |
20
|
|
|
$config = $this->processConfiguration($this->getConfiguration([], $container), $config); |
|
|
|
|
21
|
|
|
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
22
|
|
|
$this->registerResources('bitbag_sylius_wishlist_plugin', 'doctrine/orm', $config['resources'], $container); |
23
|
|
|
$loader->load('services.yml'); |
24
|
|
|
$container->setParameter('wishlist_cookie_token', $config['wishlist_cookie_token']); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function prepend(ContainerBuilder $container): void |
28
|
|
|
{ |
29
|
|
|
trigger_deprecation('bitbag/wishlist-plugin', '2.0', 'Doctrine migrations existing in a bundle will be removed, move migrations to the project directory.'); |
30
|
|
|
$this->prependDoctrineMigrations($container); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
protected function getMigrationsNamespace(): string |
34
|
|
|
{ |
35
|
|
|
return 'BitBag\SyliusWishlistPlugin\Migrations'; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
protected function getMigrationsDirectory(): string |
39
|
|
|
{ |
40
|
|
|
return '@BitBagSyliusWishlistPlugin/Migrations'; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
protected function getNamespacesOfMigrationsExecutedBefore(): array |
44
|
|
|
{ |
45
|
|
|
return ['Sylius\Bundle\CoreBundle\Migrations']; |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|