-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli-config.php
50 lines (39 loc) · 1.49 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php /* @noinspection all */
namespace Chaos;
use App\Http\Controllers\Api\Controller;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
// define('LARAVEL_START', microtime(true));
// $loader = require __DIR__ . '/vendor/autoload.php';
// Doctrine\Common\Annotations\AnnotationRegistry::registerUniqueLoader([$loader, 'loadClass']);
/* @var \Illuminate\Contracts\Http\Kernel $kernel */
$app = include_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make('Illuminate\Contracts\Console\Kernel');
$kernel->bootstrap();
new Controller();
$doctrine = doctrine();
if (empty($argv[1]) || false !== strpos($argv[1], 'orm')) {
foreach ($doctrine->getManagerNames() as $name => $id) {
if (false === strpos($id, '_entity_manager')) {
continue;
}
$helperSet = ConsoleRunner::createHelperSet(
$doctrine->getManager($name)
);
$cli = ConsoleRunner::createApplication($helperSet, []);
$cli->setAutoExit(false);
$cli->run();
}
} elseif (false !== strpos($argv[1], 'odm')) {
foreach ($doctrine->getManagerNames() as $name => $id) {
if (false === strpos($id, '_document_manager')) {
continue;
}
$helperSet = Support\Doctrine\ODM\Tools\Console\ConsoleRunner::createHelperSet(
$doctrine->getManager($name)
);
$cli = Support\Doctrine\ODM\Tools\Console\ConsoleRunner::createApplication($helperSet, []);
$cli->setAutoExit(false);
$cli->run();
}
}
exit(0);