|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Symfony\Component\DependencyInjection\Loader\Configurator; |
| 6 | + |
| 7 | +use Doctrine\Bundle\MigrationsBundle\EventListener\SchemaFilterListener; |
| 8 | +use Doctrine\Bundle\MigrationsBundle\MigrationsFactory\ContainerAwareMigrationFactory; |
| 9 | +use Doctrine\Migrations\Configuration\Configuration; |
| 10 | +use Doctrine\Migrations\Configuration\Connection\ConnectionRegistryConnection; |
| 11 | +use Doctrine\Migrations\Configuration\Connection\ExistingConnection; |
| 12 | +use Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager; |
| 13 | +use Doctrine\Migrations\Configuration\EntityManager\ManagerRegistryEntityManager; |
| 14 | +use Doctrine\Migrations\Configuration\Migration\ExistingConfiguration; |
| 15 | +use Doctrine\Migrations\DependencyFactory; |
| 16 | +use Doctrine\Migrations\Tools\Console\Command\CurrentCommand; |
| 17 | +use Doctrine\Migrations\Tools\Console\Command\DiffCommand; |
| 18 | +use Doctrine\Migrations\Tools\Console\Command\DumpSchemaCommand; |
| 19 | +use Doctrine\Migrations\Tools\Console\Command\ExecuteCommand; |
| 20 | +use Doctrine\Migrations\Tools\Console\Command\GenerateCommand; |
| 21 | +use Doctrine\Migrations\Tools\Console\Command\LatestCommand; |
| 22 | +use Doctrine\Migrations\Tools\Console\Command\ListCommand; |
| 23 | +use Doctrine\Migrations\Tools\Console\Command\MigrateCommand; |
| 24 | +use Doctrine\Migrations\Tools\Console\Command\RollupCommand; |
| 25 | +use Doctrine\Migrations\Tools\Console\Command\StatusCommand; |
| 26 | +use Doctrine\Migrations\Tools\Console\Command\SyncMetadataCommand; |
| 27 | +use Doctrine\Migrations\Tools\Console\Command\UpToDateCommand; |
| 28 | +use Doctrine\Migrations\Tools\Console\Command\VersionCommand; |
| 29 | +use Doctrine\Migrations\Version\MigrationFactory; |
| 30 | + |
| 31 | +return static function (ContainerConfigurator $container) { |
| 32 | + $container->services() |
| 33 | + ->set('doctrine.migrations.dependency_factory', DependencyFactory::class) |
| 34 | + ->args([ |
| 35 | + service('doctrine.migrations.configuration_loader'), |
| 36 | + abstract_arg('loader service'), |
| 37 | + service('logger')->nullOnInvalid(), |
| 38 | + ]) |
| 39 | + |
| 40 | + ->set('doctrine.migrations.configuration_loader', ExistingConfiguration::class) |
| 41 | + ->args([service('doctrine.migrations.configuration')]) |
| 42 | + |
| 43 | + ->set('doctrine.migrations.connection_loader', ExistingConnection::class) |
| 44 | + |
| 45 | + ->set('doctrine.migrations.em_loader', ExistingEntityManager::class) |
| 46 | + |
| 47 | + ->set('doctrine.migrations.entity_manager_registry_loader', ManagerRegistryEntityManager::class) |
| 48 | + ->args([service('doctrine')]) |
| 49 | + ->factory([ManagerRegistryEntityManager::class, 'withSimpleDefault']) |
| 50 | + |
| 51 | + ->set('doctrine.migrations.connection_registry_loader', ConnectionRegistryConnection::class) |
| 52 | + ->args([service('doctrine')]) |
| 53 | + ->factory([ConnectionRegistryConnection::class, 'withSimpleDefault']) |
| 54 | + |
| 55 | + ->set('doctrine.migrations.configuration', Configuration::class) |
| 56 | + |
| 57 | + ->set('doctrine.migrations.migrations_factory', MigrationFactory::class) |
| 58 | + ->factory([service('doctrine.migrations.dependency_factory'), 'getMigrationFactory']) |
| 59 | + |
| 60 | + ->set('doctrine.migrations.container_aware_migrations_factory', ContainerAwareMigrationFactory::class) |
| 61 | + ->decorate('doctrine.migrations.migrations_factory') |
| 62 | + ->args([ |
| 63 | + service('doctrine.migrations.container_aware_migrations_factory.inner'), |
| 64 | + service('service_container'), |
| 65 | + ]) |
| 66 | + |
| 67 | + ->set('doctrine_migrations.diff_command', DiffCommand::class) |
| 68 | + ->args([ |
| 69 | + service('doctrine.migrations.dependency_factory'), |
| 70 | + 'doctrine:migrations:diff', |
| 71 | + ]) |
| 72 | + ->tag('console.command', ['command' => 'doctrine:migrations:diff']) |
| 73 | + |
| 74 | + ->set('doctrine_migrations.sync_metadata_command', SyncMetadataCommand::class) |
| 75 | + ->args([ |
| 76 | + service('doctrine.migrations.dependency_factory'), |
| 77 | + 'doctrine:migrations:sync-metadata-storage', |
| 78 | + ]) |
| 79 | + ->tag('console.command', ['command' => 'doctrine:migrations:sync-metadata-storage']) |
| 80 | + |
| 81 | + ->set('doctrine_migrations.versions_command', ListCommand::class) |
| 82 | + ->args([ |
| 83 | + service('doctrine.migrations.dependency_factory'), |
| 84 | + 'doctrine:migrations:versions', |
| 85 | + ]) |
| 86 | + ->tag('console.command', ['command' => 'doctrine:migrations:list']) |
| 87 | + |
| 88 | + ->set('doctrine_migrations.current_command', CurrentCommand::class) |
| 89 | + ->args([ |
| 90 | + service('doctrine.migrations.dependency_factory'), |
| 91 | + 'doctrine:migrations:current', |
| 92 | + ]) |
| 93 | + ->tag('console.command', ['command' => 'doctrine:migrations:current']) |
| 94 | + |
| 95 | + ->set('doctrine_migrations.dump_schema_command', DumpSchemaCommand::class) |
| 96 | + ->args([ |
| 97 | + service('doctrine.migrations.dependency_factory'), |
| 98 | + 'doctrine:migrations:dump-schema', |
| 99 | + ]) |
| 100 | + ->tag('console.command', ['command' => 'doctrine:migrations:dump-schema']) |
| 101 | + |
| 102 | + ->set('doctrine_migrations.execute_command', ExecuteCommand::class) |
| 103 | + ->args([ |
| 104 | + service('doctrine.migrations.dependency_factory'), |
| 105 | + 'doctrine:migrations:execute', |
| 106 | + ]) |
| 107 | + ->tag('console.command', ['command' => 'doctrine:migrations:execute']) |
| 108 | + |
| 109 | + ->set('doctrine_migrations.generate_command', GenerateCommand::class) |
| 110 | + ->args([ |
| 111 | + service('doctrine.migrations.dependency_factory'), |
| 112 | + 'doctrine:migrations:generate', |
| 113 | + ]) |
| 114 | + ->tag('console.command', ['command' => 'doctrine:migrations:generate']) |
| 115 | + |
| 116 | + ->set('doctrine_migrations.latest_command', LatestCommand::class) |
| 117 | + ->args([ |
| 118 | + service('doctrine.migrations.dependency_factory'), |
| 119 | + 'doctrine:migrations:latest', |
| 120 | + ]) |
| 121 | + ->tag('console.command', ['command' => 'doctrine:migrations:latest']) |
| 122 | + |
| 123 | + ->set('doctrine_migrations.migrate_command', MigrateCommand::class) |
| 124 | + ->args([ |
| 125 | + service('doctrine.migrations.dependency_factory'), |
| 126 | + 'doctrine:migrations:migrate', |
| 127 | + ]) |
| 128 | + ->tag('console.command', ['command' => 'doctrine:migrations:migrate']) |
| 129 | + |
| 130 | + ->set('doctrine_migrations.rollup_command', RollupCommand::class) |
| 131 | + ->args([ |
| 132 | + service('doctrine.migrations.dependency_factory'), |
| 133 | + 'doctrine:migrations:rollup', |
| 134 | + ]) |
| 135 | + ->tag('console.command', ['command' => 'doctrine:migrations:rollup']) |
| 136 | + |
| 137 | + ->set('doctrine_migrations.status_command', StatusCommand::class) |
| 138 | + ->args([ |
| 139 | + service('doctrine.migrations.dependency_factory'), |
| 140 | + 'doctrine:migrations:status', |
| 141 | + ]) |
| 142 | + ->tag('console.command', ['command' => 'doctrine:migrations:status']) |
| 143 | + |
| 144 | + ->set('doctrine_migrations.up_to_date_command', UpToDateCommand::class) |
| 145 | + ->args([ |
| 146 | + service('doctrine.migrations.dependency_factory'), |
| 147 | + 'doctrine:migrations:up-to-date', |
| 148 | + ]) |
| 149 | + ->tag('console.command', ['command' => 'doctrine:migrations:up-to-date']) |
| 150 | + |
| 151 | + ->set('doctrine_migrations.version_command', VersionCommand::class) |
| 152 | + ->args([ |
| 153 | + service('doctrine.migrations.dependency_factory'), |
| 154 | + 'doctrine:migrations:version', |
| 155 | + ]) |
| 156 | + ->tag('console.command', ['command' => 'doctrine:migrations:version']) |
| 157 | + |
| 158 | + ->set('doctrine_migrations.schema_filter_listener', SchemaFilterListener::class) |
| 159 | + // The "doctrine.dbal.schema_filter" tag is dynamically added for each connection |
| 160 | + ->tag('kernel.event_listener', ['event' => 'console.command', 'method' => 'onConsoleCommand']); |
| 161 | +}; |
0 commit comments