Skip to content

Commit

Permalink
Merge branch 'sf4'
Browse files Browse the repository at this point in the history
* sf4:
  Add compatibility with symfony4
  • Loading branch information
mvrhov committed Dec 28, 2017
2 parents eee93e1 + 127fbe1 commit c093926
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions DependencyInjection/mvrhovPhinxExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
namespace mvrhov\PhinxBundle\DependencyInjection;

use Phinx\Config\Config;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
Expand Down Expand Up @@ -69,10 +71,14 @@ public function load(array $configs, ContainerBuilder $container)

$env = $container->register('phinx.config', Config::class);
$env->setArguments([$options]);
$env->setPublic(true);

if (isset($config['adapters'])) {
$container->setParameter('phinx.adapters', $config['adapters']);
}

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('console.xml');
}

}
28 changes: 28 additions & 0 deletions Resources/config/console.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="mvrhov_phinx.command.breakpoint_command" class="mvrhov\PhinxBundle\Command\BreakpointCommand" public="false">
<tag name="console.command" command="phinx:breakpoint" />
</service>

<service id="mvrhov_phinx.command.create_command" class="mvrhov\PhinxBundle\Command\CreateCommand" public="false">
<tag name="console.command" command="phinx:create" />
</service>

<service id="mvrhov_phinx.command.migrate_command" class="mvrhov\PhinxBundle\Command\MigrateCommand" public="false">
<tag name="console.command" command="phinx:migrate" />
</service>

<service id="mvrhov_phinx.command.rollback_command" class="mvrhov\PhinxBundle\Command\RollbackCommand" public="false">
<tag name="console.command" command="phinx:rollback" />
</service>

<service id="mvrhov_phinx.command.status_command" class="mvrhov\PhinxBundle\Command\StatusCommand" public="false">
<tag name="console.command" command="phinx:status" />
</service>
</services>
</container>

0 comments on commit c093926

Please sign in to comment.