src/DoctrineMigrationsProvider.php
public function register(Container $app)
    {
        $app['migrations.output_writer'] = function (Container $app) {
            return new OutputWriter(
                function ($message) {
                    $output = new ConsoleOutput();
                    $output->writeln($message);
                }
            );
        };

        $app['migrations.directory']  = null;
        $app['migrations.name']       = 'Migrations';
        $app['migrations.namespace']  = null;
        $app['migrations.table_name'] = 'migration_versions';

        $app['migrations.em_helper_set'] = function (Container $app) {
            $helpers = [
                'connection' => new ConnectionHelper($app['db']),
            ];

            if (class_exists('\Symfony\Component\Console\Helper\QuestionHelper')) {
                $helpers['question'] = new Helper\QuestionHelper();
            } else {
                $helpers['dialog'] = new Helper\DialogHelper();
            }

            if (isset($app['orm.em'])) {
                $helpers['em'] = new EntityManagerHelper($app['orm.em']);
            }

            return new Helper\HelperSet($helpers);
        };

        $app['migrations.configuration'] = function (Container $app) {
            $configuration = new Configuration($app['db'], $app['migrations.output_writer']);

            $configuration->setMigrationsDirectory($app['migrations.directory']);
            $configuration->setName($app['migrations.name']);
            $configuration->setMigrationsNamespace($app['migrations.namespace']);
            $configuration->setMigrationsTableName($app['migrations.table_name']);

            $configuration->registerMigrationsFromDirectory($app['migrations.directory']);

            return $configuration;
        };

        $app['migrations.command_names'] = function (Container $app) {
            $commands = [
                MigrationsCommand\ExecuteCommand::class,
                MigrationsCommand\GenerateCommand::class,
                MigrationsCommand\LatestCommand::class,
                MigrationsCommand\MigrateCommand::class,
                MigrationsCommand\StatusCommand::class,
                MigrationsCommand\VersionCommand::class,
                MigrationsCommand\UpToDateCommand::class,
            ];

            $console = $this->getConsole($app);
            // @codeCoverageIgnoreStart
            if ($console && true === $console->getHelperSet()->has('em')) {
                $commands[] = MigrationsCommand\DiffCommand::class;
            }
            // @codeCoverageIgnoreEnd

            return $commands;
        };

        $app['migrations.commands'] = function (Container $app) {
            $commands = [];
            foreach ($app['migrations.command_names'] as $name) {
                /** @var MigrationsCommand\AbstractCommand $command */
                $command = new $name();
                $command->setMigrationConfiguration($app['migrations.configuration']);
                $commands[] = $command;
            }

            return $commands;
        };
    }
public function register(Container $app)
    {
        $app['migrations.output_writer'] = function (Container $app) {
            return new OutputWriter(
                function ($message) {
                    $output = new ConsoleOutput();
                    $output->writeln($message);
                }
            );
        };

        $app['migrations.directory']  = null;
        $app['migrations.name']       = 'Migrations';
        $app['migrations.namespace']  = null;
        $app['migrations.table_name'] = 'migration_versions';

        $app['migrations.em_helper_set'] = function (Container $app) {
            $helpers = [
                'connection' => new ConnectionHelper($app['db']),
            ];

            if (class_exists('\Symfony\Component\Console\Helper\QuestionHelper')) {
                $helpers['question'] = new Helper\QuestionHelper();
            } else {
                $helpers['dialog'] = new Helper\DialogHelper();
            }

            if (isset($app['orm.em'])) {
                $helpers['em'] = new EntityManagerHelper($app['orm.em']);
            }

            return new Helper\HelperSet($helpers);
        };

        $app['migrations.configuration'] = function (Container $app) {
            $configuration = new Configuration($app['db'], $app['migrations.output_writer']);

            $configuration->setMigrationsDirectory($app['migrations.directory']);
            $configuration->setName($app['migrations.name']);
            $configuration->setMigrationsNamespace($app['migrations.namespace']);
            $configuration->setMigrationsTableName($app['migrations.table_name']);

            $configuration->registerMigrationsFromDirectory($app['migrations.directory']);

            return $configuration;
        };

        $app['migrations.command_names'] = function (Container $app) {
            $commands = [
                MigrationsCommand\ExecuteCommand::class,
                MigrationsCommand\GenerateCommand::class,
                MigrationsCommand\LatestCommand::class,
                MigrationsCommand\MigrateCommand::class,
                MigrationsCommand\StatusCommand::class,
                MigrationsCommand\VersionCommand::class,
                MigrationsCommand\UpToDateCommand::class,
            ];

            $console = $this->getConsole($app);
            // @codeCoverageIgnoreStart
            if ($console && true === $console->getHelperSet()->has('em')) {
                $commands[] = MigrationsCommand\DiffCommand::class;
            }
            // @codeCoverageIgnoreEnd

            return $commands;
        };

        $app['migrations.commands'] = function (Container $app) {
            $commands = [];
            foreach ($app['migrations.command_names'] as $name) {
                /** @var MigrationsCommand\AbstractCommand $command */
                $command = new $name();
                $command->setMigrationConfiguration($app['migrations.configuration']);
                $commands[] = $command;
            }

            return $commands;
        };
    }
Registers services on the given app.

This method should only be used to configure services and parameters.
It should not get services.

@param Container $app A Pimple container instance