Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Kraz\DoctrineContextBundle\Command\Doctrine\ContextRunner;
use Kraz\DoctrineContextBundle\Command\Doctrine\Database\CreateDatabaseCommand;
use Kraz\DoctrineContextBundle\Command\Doctrine\Strategy\ConnectionStrategy;
use Kraz\DoctrineContextBundle\Configuration\Configuration as DoctrineContextConfiguration;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand All @@ -13,11 +15,19 @@
->set('doctrine.doctrine_context.configuration', DoctrineContextConfiguration::class)
->public()

->set('doctrine.doctrine_context.strategy.connection', ConnectionStrategy::class)

->set('doctrine.doctrine_context.context_runner', ContextRunner::class)
->public()
->args([
service('doctrine.doctrine_context.configuration'),
])

->set('doctrine.database_create_command.with_context', CreateDatabaseCommand::class)
->decorate('doctrine.database_create_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:database:create']);
};
29 changes: 16 additions & 13 deletions config/services_migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Kraz\DoctrineContextBundle\Command\Doctrine\Migrations\SyncMetadataCommand;
use Kraz\DoctrineContextBundle\Command\Doctrine\Migrations\UpToDateCommand;
use Kraz\DoctrineContextBundle\Command\Doctrine\Migrations\VersionCommand;
use Kraz\DoctrineContextBundle\Command\Doctrine\Strategy\MigrationStrategy;
use Symfony\Component\DependencyInjection\ContainerInterface;

return static function (ContainerConfigurator $container): void {
Expand All @@ -29,107 +30,109 @@
->set('doctrine.doctrine_context.dependency_factory', DependencyFactory::class)
->abstract()

->set('doctrine.doctrine_context.strategy.migration', MigrationStrategy::class)

->set('doctrine_migrations.current_command.with_context', CurrentCommand::class)
->decorate('doctrine_migrations.current_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:current'])

->set('doctrine_migrations.diff_command.with_context', DiffCommand::class)
->decorate('doctrine_migrations.diff_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:diff'])

->set('doctrine_migrations.dump_schema_command.with_context', DumpSchemaCommand::class)
->decorate('doctrine_migrations.dump_schema_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:dump-schema'])

->set('doctrine_migrations.execute_command.with_context', ExecuteCommand::class)
->decorate('doctrine_migrations.execute_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:execute'])

->set('doctrine_migrations.generate_command.with_context', GenerateCommand::class)
->decorate('doctrine_migrations.generate_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:generate'])

->set('doctrine_migrations.latest_command.with_context', LatestCommand::class)
->decorate('doctrine_migrations.latest_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:latest'])

->set('doctrine_migrations.versions_command.with_context', ListCommand::class)
->decorate('doctrine_migrations.versions_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:list'])

->set('doctrine_migrations.migrate_command.with_context', MigrateCommand::class)
->decorate('doctrine_migrations.migrate_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:migrate'])

->set('doctrine_migrations.rollup_command.with_context', RollupCommand::class)
->decorate('doctrine_migrations.rollup_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:rollup'])

->set('doctrine_migrations.status_command.with_context', StatusCommand::class)
->decorate('doctrine_migrations.status_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:status'])

->set('doctrine_migrations.sync_metadata_command.with_context', SyncMetadataCommand::class)
->decorate('doctrine_migrations.sync_metadata_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:sync-metadata-storage'])

->set('doctrine_migrations.up_to_date_command.with_context', UpToDateCommand::class)
->decorate('doctrine_migrations.up_to_date_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:up-to-date'])

->set('doctrine_migrations.version_command.with_context', VersionCommand::class)
->decorate('doctrine_migrations.version_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:migrations:version']);
};
9 changes: 6 additions & 3 deletions config/services_orm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,34 @@
use Kraz\DoctrineContextBundle\Command\Doctrine\Mapping\InfoCommand;
use Kraz\DoctrineContextBundle\Command\Doctrine\Schema\CreateSchemaCommand;
use Kraz\DoctrineContextBundle\Command\Doctrine\Schema\ValidateSchemaCommand;
use Kraz\DoctrineContextBundle\Command\Doctrine\Strategy\EntityManagerStrategy;
use Symfony\Component\DependencyInjection\ContainerInterface;

return static function (ContainerConfigurator $container): void {
$container->services()
->set('doctrine.doctrine_context.strategy.entity_manager', EntityManagerStrategy::class)

->set('doctrine.mapping_info_command.with_context', InfoCommand::class)
->decorate('doctrine.mapping_info_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:mapping:info'])

->set('doctrine.schema_create_command.with_context', CreateSchemaCommand::class)
->decorate('doctrine.schema_create_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:schema:create'])

->set('doctrine.schema_validate_command.with_context', ValidateSchemaCommand::class)
->decorate('doctrine.schema_validate_command', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
->args([
service('.inner'),
service('doctrine.doctrine_context.configuration'),
service('doctrine.doctrine_context.context_runner'),
])
->tag('console.command', ['command' => 'doctrine:schema:validate']);
};
7 changes: 0 additions & 7 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,5 @@
<directory name="tests"/>
</errorLevel>
</ClassMustBeFinal>

<RedundantCast>
<errorLevel type="suppress">
<directory name="src"/>
<directory name="tests"/>
</errorLevel>
</RedundantCast>
</issueHandlers>
</psalm>
Loading
Loading