diff --git a/src/DependencyInjection/BitBagSyliusWishlistExtension.php b/src/DependencyInjection/BitBagSyliusWishlistExtension.php index 3b6b26ec..83bfe530 100644 --- a/src/DependencyInjection/BitBagSyliusWishlistExtension.php +++ b/src/DependencyInjection/BitBagSyliusWishlistExtension.php @@ -26,7 +26,7 @@ public function load(array $config, ContainerBuilder $container): void { $config = $this->processConfiguration($this->getConfiguration([], $container), $config); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); - $this->registerResources('bitbag_sylius_wishlist_plugin', 'doctrine/orm', $config['resources'], $container); + $loader->load('services.xml'); $container->setParameter('bitbag_sylius_wishlist_plugin.parameters.wishlist_cookie_token', $config['wishlist_cookie_token']); $container->setParameter('bitbag_sylius_wishlist_plugin.parameters.allowed_mime_types', $config['allowed_mime_types']); @@ -36,6 +36,9 @@ public function prepend(ContainerBuilder $container): void { trigger_deprecation('bitbag/wishlist-plugin', '2.0', 'Doctrine migrations existing in a bundle will be removed, move migrations to the project directory.'); $this->prependDoctrineMigrations($container); + + $config = $this->getCurrentConfiguration($container); + $this->registerResources('bitbag_sylius_wishlist_plugin', 'doctrine/orm', $config['resources'], $container); } protected function getMigrationsNamespace(): string @@ -52,4 +55,13 @@ protected function getNamespacesOfMigrationsExecutedBefore(): array { return ['Sylius\Bundle\CoreBundle\Migrations']; } + + private function getCurrentConfiguration(ContainerBuilder $container): array + { + /** @var ConfigurationInterface $configuration */ + $configuration = $this->getConfiguration([], $container); + $configs = $container->getExtensionConfig($this->getAlias()); + + return $this->processConfiguration($configuration, $configs); + } }