1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file was created by developers working at BitBag |
5
|
|
|
* Do you need more information about us and what we do? Visit our https://bitbag.io website! |
6
|
|
|
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
declare(strict_types=1); |
10
|
|
|
|
11
|
|
|
namespace BitBag\SyliusWishlistPlugin\DependencyInjection; |
12
|
|
|
|
13
|
|
|
use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait; |
14
|
|
|
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension; |
15
|
|
|
use Symfony\Component\Config\FileLocator; |
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
17
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
18
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
19
|
|
|
|
20
|
|
|
final class BitBagSyliusWishlistExtension extends AbstractResourceExtension implements PrependExtensionInterface |
21
|
|
|
{ |
22
|
|
|
use PrependDoctrineMigrationsTrait; |
23
|
|
|
|
24
|
|
|
public function load(array $config, ContainerBuilder $container): void |
25
|
|
|
{ |
26
|
|
|
$config = $this->processConfiguration($this->getConfiguration([], $container), $config); |
|
|
|
|
27
|
|
|
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
28
|
|
|
$this->registerResources('bitbag_sylius_wishlist_plugin', 'doctrine/orm', $config['resources'], $container); |
29
|
|
|
$loader->load('services.yml'); |
30
|
|
|
$container->setParameter('bitbag_sylius_wishlist_plugin.parameters.wishlist_cookie_token', $config['wishlist_cookie_token']); |
31
|
|
|
$container->setParameter('bitbag_sylius_wishlist_plugin.parameters.allowed_mime_types', $config['allowed_mime_types']); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function prepend(ContainerBuilder $container): void |
35
|
|
|
{ |
36
|
|
|
trigger_deprecation('bitbag/wishlist-plugin', '2.0', 'Doctrine migrations existing in a bundle will be removed, move migrations to the project directory.'); |
37
|
|
|
$this->prependDoctrineMigrations($container); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
protected function getMigrationsNamespace(): string |
41
|
|
|
{ |
42
|
|
|
return 'BitBag\SyliusWishlistPlugin\Migrations'; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
protected function getMigrationsDirectory(): string |
46
|
|
|
{ |
47
|
|
|
return '@BitBagSyliusWishlistPlugin/Migrations'; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
protected function getNamespacesOfMigrationsExecutedBefore(): array |
51
|
|
|
{ |
52
|
|
|
return ['Sylius\Bundle\CoreBundle\Migrations']; |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|