2009-09-02 04:14:10 +04:00
|
|
|
<?php
|
|
|
|
|
2010-01-22 19:42:48 +03:00
|
|
|
require_once 'Doctrine/Common/ClassLoader.php';
|
2009-09-02 04:14:10 +04:00
|
|
|
|
2010-05-26 04:00:17 +04:00
|
|
|
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
|
2010-04-09 17:34:53 +04:00
|
|
|
$classLoader->register();
|
|
|
|
|
2010-05-26 04:00:17 +04:00
|
|
|
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
|
2009-11-05 01:16:22 +03:00
|
|
|
$classLoader->register();
|
2009-09-02 04:14:10 +04:00
|
|
|
|
2010-01-27 22:20:47 +03:00
|
|
|
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
|
2009-12-21 20:38:14 +03:00
|
|
|
|
2010-04-09 17:34:53 +04:00
|
|
|
$helperSet = null;
|
2010-01-27 22:20:47 +03:00
|
|
|
if (file_exists($configFile)) {
|
|
|
|
if ( ! is_readable($configFile)) {
|
|
|
|
trigger_error(
|
|
|
|
'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
require $configFile;
|
|
|
|
|
2010-04-09 17:34:53 +04:00
|
|
|
foreach ($GLOBALS as $helperSetCandidate) {
|
2010-08-23 10:21:41 +04:00
|
|
|
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
|
2010-04-09 17:34:53 +04:00
|
|
|
$helperSet = $helperSetCandidate;
|
2010-01-27 22:20:47 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-23 10:21:41 +04:00
|
|
|
$helperSet = ($helperSet) ?: new \Symfony\Component\Console\Helper\HelperSet();
|
2010-04-09 17:34:53 +04:00
|
|
|
|
2010-08-23 10:21:41 +04:00
|
|
|
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\ORM\Version::VERSION);
|
2010-04-09 17:34:53 +04:00
|
|
|
$cli->setCatchExceptions(true);
|
|
|
|
$cli->setHelperSet($helperSet);
|
|
|
|
$cli->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(),
|
2010-05-12 01:08:36 +04:00
|
|
|
new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(),
|
2010-03-10 22:07:02 +03:00
|
|
|
|
2010-04-09 17:34:53 +04:00
|
|
|
));
|
2010-08-23 10:21:41 +04:00
|
|
|
$cli->run();
|