-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathexpennies
34 lines (25 loc) · 1.23 KB
/
expennies
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
<?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;
use Doctrine\ORM\EntityManagerInterface;
$container = require 'bootstrap.php';
$config = $container->get(Config::class);
$entityManager = $container->get(EntityManagerInterface::class);
$dependencyFactory = DependencyFactory::fromEntityManager(
new PhpFile(CONFIG_PATH . '/migrations.php'),
new ExistingEntityManager($entityManager)
);
$migrationCommands = require CONFIG_PATH . '/commands/migration_commands.php';
$customCommands = require CONFIG_PATH . '/commands/commands.php';
$cliApp = new Application($config->get('app_name'), $config->get('app_version'));
ConsoleRunner::addCommands($cliApp, new SingleManagerProvider($entityManager));
$cliApp->addCommands($migrationCommands($dependencyFactory));
$cliApp->addCommands(array_map(fn($command) => $container->get($command), $customCommands));
$cliApp->run();