Skip to content

Commit

Permalink
Merge pull request #21 from lanfisis/fix/doctrine-migration-path-decl…
Browse files Browse the repository at this point in the history
…aration

Declare migration path using prepend config extension
  • Loading branch information
lanfisis authored Apr 2, 2021
2 parents c0af9da + 1f428e6 commit 70619e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
16 changes: 15 additions & 1 deletion src/DependencyInjection/MonsieurBizSyliusCmsPageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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',
]),
]);
}
}
3 changes: 0 additions & 3 deletions src/Resources/config/app/doctrine_migrations.yaml

This file was deleted.

1 change: 0 additions & 1 deletion src/Resources/config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
imports:
- { resource: 'app/doctrine_migrations.yaml' }
- { resource: "sylius/resources.yaml" }
- { resource: "sylius/grid.yaml" }
- { resource: "sylius/fixtures.yaml" }

0 comments on commit 70619e0

Please sign in to comment.