-
Notifications
You must be signed in to change notification settings - Fork 41
/
cli-config.php
37 lines (25 loc) · 966 Bytes
/
cli-config.php
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
37
<?php
require_once (realpath(__DIR__ . '/vendor/autoload.php'));
use Mamluk\Kipchak\Api;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider;
use Psr\Container\ContainerInterface;
$app = Api::bootCli();
/**
* ContainerInterface
*/
$container = $app->getContainer();
$ems = $container->get('config')['kipchak.doctrine']['orm']['entity_managers'];
$entityManagers = [];
$commands = [
// If you want to add your own custom console commands,
// you can do so here.
];
foreach ($ems as $name => $em) {
ConsoleRunner::run(
new SingleManagerProvider($container->get('database.doctrine.entitymanager.' . $name), $name),
$commands
);
}
// Now entity managers can be run on the CLI via:
// php vendor/bin/doctrine orm:info --em primary (primary here being defined in kipchak.doctrine as an entity_manager in the orm section