-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyapp
36 lines (25 loc) · 1.25 KB
/
myapp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
use App\Config;
use Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager;
use Doctrine\Migrations\Configuration\Migration\PhpFile;
use Doctrine\Migrations\DependencyFactory;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider;
use Symfony\Component\Console\Application;
$container = require(__DIR__ . '/bootstrap.php');
$entityManager = $container->get(EntityManager::class);
$appConfig = $container->get(Config::class);
$config = new PhpFile(CONFIG_PATH . '/migrations.php');
$dependencyFactory = DependencyFactory::fromEntityManager($config, new ExistingEntityManager($entityManager));
$migrationCommands = require(CONFIG_PATH . '/commands/migration_commands.php');
$customCommands = require(CONFIG_PATH . '/commands/custom_commands.php');
$application = new Application($appConfig->get('app_name'), $appConfig->get('app_version'));
ConsoleRunner::addCommands($application, new SingleManagerProvider($entityManager));
$application->addCommands($migrationCommands($dependencyFactory));
$application->addCommands(array_map(
fn($command) => $container->get($command),
$customCommands
));
$application->run();