From 1d7c9fd55329e14aff191cfcde8db67392924833 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 23 Jun 2023 09:16:33 +0200 Subject: [PATCH] Refactor cli-config file as it's currently used by doctrine migrations only --- config/cli-config.php | 22 ++++++++++++++++++++-- migrations.php | 15 --------------- 2 files changed, 20 insertions(+), 17 deletions(-) delete mode 100644 migrations.php diff --git a/config/cli-config.php b/config/cli-config.php index 52659e4e..1f211557 100644 --- a/config/cli-config.php +++ b/config/cli-config.php @@ -2,11 +2,29 @@ declare(strict_types=1); +use Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager; +use Doctrine\Migrations\Configuration\Migration\ConfigurationArray; +use Doctrine\Migrations\DependencyFactory; use Doctrine\ORM\EntityManager; -use Doctrine\ORM\Tools\Console\ConsoleRunner; + +// This file is currently used by docrtrine migrations only return (static function () { /** @var EntityManager $em */ $em = include __DIR__ . '/entity-manager.php'; - return ConsoleRunner::createHelperSet($em); + + $migrationsConfig = [ + 'migrations_paths' => [ + 'ShlinkMigrations' => 'data/migrations', + ], + 'table_storage' => [ + 'table_name' => 'migrations', + ], + 'custom_template' => 'data/migrations_template.txt', + ]; + + return DependencyFactory::fromEntityManager( + new ConfigurationArray($migrationsConfig), + new ExistingEntityManager($em), + ); })(); diff --git a/migrations.php b/migrations.php deleted file mode 100644 index 306c1c08..00000000 --- a/migrations.php +++ /dev/null @@ -1,15 +0,0 @@ - [ - 'ShlinkMigrations' => 'data/migrations', - ], - 'table_storage' => [ - 'table_name' => 'migrations', - ], - 'custom_template' => 'data/migrations_template.txt', - -];