From 1f428e624966fa898f8683af63176b8bdc1d807b Mon Sep 17 00:00:00 2001 From: David Buros Date: Fri, 2 Apr 2021 13:40:47 +0200 Subject: [PATCH] Declare migration path using prepend config extension --- .../MonsieurBizSyliusCmsPageExtension.php | 16 +++++++++++++++- .../config/app/doctrine_migrations.yaml | 3 --- src/Resources/config/config.yaml | 1 - 3 files changed, 15 insertions(+), 5 deletions(-) delete mode 100644 src/Resources/config/app/doctrine_migrations.yaml diff --git a/src/DependencyInjection/MonsieurBizSyliusCmsPageExtension.php b/src/DependencyInjection/MonsieurBizSyliusCmsPageExtension.php index 867e81f..081dcb6 100644 --- a/src/DependencyInjection/MonsieurBizSyliusCmsPageExtension.php +++ b/src/DependencyInjection/MonsieurBizSyliusCmsPageExtension.php @@ -16,9 +16,10 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; +use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -final class MonsieurBizSyliusCmsPageExtension extends Extension +final class MonsieurBizSyliusCmsPageExtension extends Extension implements PrependExtensionInterface { /** * {@inheritdoc} @@ -37,4 +38,17 @@ public function getAlias() { return str_replace('monsieur_biz', 'monsieurbiz', parent::getAlias()); } + + /** + * {@inheritdoc} + */ + public function prepend(ContainerBuilder $container): void + { + $doctrineConfig = $container->getExtensionConfig('doctrine_migrations'); + $container->prependExtensionConfig('doctrine_migrations', [ + 'migrations_paths' => array_merge(array_pop($doctrineConfig)['migrations_paths'] ?? [], [ + 'MonsieurBiz\SyliusCmsPagePlugin\Migrations' => '@MonsieurBizSyliusCmsPagePlugin/Migrations', + ]), + ]); + } } diff --git a/src/Resources/config/app/doctrine_migrations.yaml b/src/Resources/config/app/doctrine_migrations.yaml deleted file mode 100644 index 3d4dd12..0000000 --- a/src/Resources/config/app/doctrine_migrations.yaml +++ /dev/null @@ -1,3 +0,0 @@ -doctrine_migrations: - migrations_paths: - 'MonsieurBiz\SyliusCmsPagePlugin\Migrations': "@MonsieurBizSyliusCmsPagePlugin/Migrations" diff --git a/src/Resources/config/config.yaml b/src/Resources/config/config.yaml index a8ae9f6..8bb2eda 100644 --- a/src/Resources/config/config.yaml +++ b/src/Resources/config/config.yaml @@ -1,5 +1,4 @@ imports: - - { resource: 'app/doctrine_migrations.yaml' } - { resource: "sylius/resources.yaml" } - { resource: "sylius/grid.yaml" } - { resource: "sylius/fixtures.yaml" }