Rename doctrine utility to developer, add Sqlite Regeneration command

This commit is contained in:
Romain Neutron
2013-05-28 19:33:09 +02:00
parent 7fa46369fb
commit 634d88d5e6
3 changed files with 68 additions and 2 deletions

91
bin/developer Executable file
View File

@@ -0,0 +1,91 @@
#!/usr/bin/env php
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\CLI;
use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
// DBAL Commands
use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
use Doctrine\DBAL\Tools\Console\Command\ImportCommand;
// ORM Commands
use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand;
use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand;
use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand;
use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand;
use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand;
use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand;
use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand;
use Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand;
use Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand;
use Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand;
use Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand;
use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand;
use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand;
require_once __DIR__ . '/../vendor/autoload.php';
try {
$cli = new CLI("
___ ___ _ _ ___ __ __ ___ ___ ___ ____ __ __ __ ___
( \( _)( )( )( _)( ) / \( ,\( _)( ,) (_ _)/ \ / \( ) / __)
) ) )) _) \\// ) _) )(__( () )) _/ ) _) ) \ )( ( () )( () ))(__ \__ \
(___/(___) (__) (___)(____)\__/(_) (___)(_)\_) (__) \__/ \__/(____)(___/
Phraseanet Copyright (C) 2004 Alchemy
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `about:license' for details.\n\n"
. ' Phraseanet Developer Tools ', Version::getName() . ' ' . Version::getNumber());
$helpers = array(
'db' => new ConnectionHelper($cli['EM']->getConnection()),
'em' => new EntityManagerHelper($cli['EM'])
);
$helperSet = $cli['console']->getHelperSet();
foreach ($helpers as $name => $helper) {
$helperSet->set($helper, $name);
}
$cli->command(new RegenerateSqliteDb('phrasea:regenerate-sqlite'));
$cli['console']->addCommands(array(
// DBAL Commands
new RunSqlCommand(),
new ImportCommand(),
// ORM Commands
new MetadataCommand(),
new ResultCommand(),
new QueryCommand(),
new CreateCommand(),
new UpdateCommand(),
new DropCommand(),
new EnsureProductionSettingsCommand(),
new ConvertDoctrine1SchemaCommand(),
new GenerateRepositoriesCommand(),
new GenerateEntitiesCommand(),
new GenerateProxiesCommand(),
new ConvertMappingCommand(),
new RunDqlCommand(),
new ValidateSchemaCommand(),
));
$cli->runCLI();
} catch (Exception $e) {
echo "an error occured : " . $e->getMessage();
exit(1);
}
exit(0);