-
Notifications
You must be signed in to change notification settings - Fork 0
/
console
51 lines (44 loc) · 2.15 KB
/
console
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
51
#!/usr/bin/env php
<?php
ini_set('display_errors', 1);
require_once __DIR__.'/vendor/autoload.php';
\Symfony\Component\ClassLoader\DebugClassLoader::enable();
\Symfony\Component\HttpKernel\Debug\ErrorHandler::register();
$app = new App\Application();
$app->register(new \Knp\Provider\ConsoleServiceProvider(), array(
'console.name' => 'SilexApplication',
'console.version' => '1.0.0',
'console.project_directory' => __DIR__
));
# création des helper pour le CLI de Doctrine
$em = $app['orm.em'];
$helperSet = $app['console']->getHelperSet();
$helperSet->set(new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'db');
$helperSet->set(new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em), 'em');
$helperSet->set(new \Symfony\Component\Console\Helper\DialogHelper(), 'dialog');
# ajout des commandes de Doctrine
$app['console']->addCommands(array(
// DBAL Commands
new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
// ORM Commands
new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(),
new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(),
new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(),
new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(),
new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(),
new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(),
new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(),
new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(),
new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(),
new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(),
new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(),
new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(),
new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(),
new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(),
));
# ajout des commandes de l'application
$app['console']->addCommands(array(
new \App\Command\UserAddCommand()
));
$app['console']->run();