Skip to content

Commit

Permalink
Set up Doctrine Migrations v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Apr 24, 2020
1 parent 7b2510b commit e8b6743
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
],
"require": {
"php": "^7.2",
"doctrine/migrations": "^3.0@alpha",
"doctrine/doctrine-migrations-bundle": "^3.0@alpha",
"knplabs/knp-snappy-bundle": "^1.5",
"myclabs/php-enum": "^1.7",
"sylius/resource-bundle": "^1.6",
"sylius/sylius": "^1.5",
"sylius/sylius": "dev-migrations-alpha",
"symfony/messenger": "^4.3"
},
"require-dev": {
Expand Down Expand Up @@ -55,6 +57,8 @@
"symfony/doctrine-bridge": "4.3.0",
"symfony/framework-bundle": "4.3.0"
},
"minimum-stability": "alpha",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Sylius\\RefundPlugin\\": "src/",
Expand Down
22 changes: 21 additions & 1 deletion src/DependencyInjection/SyliusRefundExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,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\XmlFileLoader;

final class SyliusRefundExtension extends Extension
final class SyliusRefundExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
Expand All @@ -21,4 +22,23 @@ public function load(array $config, ContainerBuilder $container): void

$loader->load('services.xml');
}

public function prepend(ContainerBuilder $container): void
{
if (!$container->hasExtension('doctrine_migrations') || !$container->hasExtension('sylius_core')) {
return;
}

$container->prependExtensionConfig('doctrine_migrations', [
'migrations_paths' => [
'Sylius\RefundPlugin\Migrations' => __DIR__. '/../Migrations',
],
]);

$container->prependExtensionConfig('sylius_core', [
'migrations' => [
'Sylius\RefundPlugin\Migrations' => ['Sylius\Bundle\CoreBundle\Migrations'],
],
]);
}
}

0 comments on commit e8b6743

Please sign in to comment.