Skip to content

Commit

Permalink
Change doctrine config
Browse files Browse the repository at this point in the history
  • Loading branch information
clemence pereira committed May 7, 2021
1 parent 000f76b commit b3bfccb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
16 changes: 15 additions & 1 deletion src/DependencyInjection/MonsieurBizSyliusSettingsExtension.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 MonsieurBizSyliusSettingsExtension extends Extension
final class MonsieurBizSyliusSettingsExtension 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\SyliusSettingsPlugin\Migrations' => '@MonsieurBizSyliusSettingsPlugin/Migrations',
]),
]);
}
}
3 changes: 0 additions & 3 deletions src/Resources/config/app/doctrine_migrations.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Resources/config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
imports:
- { resource: 'app/doctrine_migrations.yaml' }
- { resource: 'sylius_labs_doctrine_migrations_extra.yaml' }
- { resource: "sylius/resources.yaml" }
- { resource: "sylius/ui_events.yaml" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sylius_labs_doctrine_migrations_extra:
migrations:
'MonsieurBiz\SyliusSettingsPlugin\Migrations': ~

0 comments on commit b3bfccb

Please sign in to comment.