[2.0][DDC-274] Fixing Coding Standards for CLI tool.
This commit is contained in:
parent
50c4e50921
commit
b2167985ad
@ -18,14 +18,14 @@ if (file_exists($configFile)) {
|
||||
require $configFile;
|
||||
|
||||
foreach ($GLOBALS as $configCandidate) {
|
||||
if ($configCandidate instanceof \Doctrine\Common\Cli\Configuration) {
|
||||
if ($configCandidate instanceof \Doctrine\Common\CLI\Configuration) {
|
||||
$configuration = $configCandidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$configuration = ($configuration) ?: new \Doctrine\Common\Cli\Configuration();
|
||||
$configuration = ($configuration) ?: new \Doctrine\Common\CLI\Configuration();
|
||||
|
||||
$cli = new \Doctrine\Common\Cli\CliController($configuration);
|
||||
$cli = new \Doctrine\Common\CLI\CLIController($configuration);
|
||||
$cli->run($_SERVER['argv']);
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
use Doctrine\Common\Util\Inflector;
|
||||
|
||||
@ -73,7 +73,7 @@ abstract class AbstractNamespace
|
||||
$name = self::formatName($name);
|
||||
|
||||
if ($this->hasNamespace($name)) {
|
||||
throw CliException::cannotOverrideNamespace($name);
|
||||
throw CLIException::cannotOverrideNamespace($name);
|
||||
}
|
||||
|
||||
return $this->overrideNamespace($name);
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
/**
|
||||
* Generic CLI Controller of Tasks execution
|
||||
@ -27,7 +27,7 @@ namespace Doctrine\Common\Cli;
|
||||
* To include a new Task support, create a task:
|
||||
*
|
||||
* [php]
|
||||
* class MyProject\Tools\Cli\Tasks\MyTask extends Doctrine\ORM\Tools\Cli\Tasks\AbstractTask
|
||||
* class MyProject\Tools\CLI\Tasks\MyTask extends Doctrine\ORM\Tools\CLI\Tasks\AbstractTask
|
||||
* {
|
||||
* public function run();
|
||||
* public function basicHelp();
|
||||
@ -38,9 +38,9 @@ namespace Doctrine\Common\Cli;
|
||||
* And then, load the namespace assoaicated an include the support to it in your command-line script:
|
||||
*
|
||||
* [php]
|
||||
* $cli = new Doctrine\Common\Cli\CliController();
|
||||
* $cli = new Doctrine\Common\CLI\CLIController();
|
||||
* $cliNS = $cli->getNamespace('custom');
|
||||
* $cliNS->addTask('myTask', 'MyProject\Tools\Cli\Tasks\MyTask');
|
||||
* $cliNS->addTask('myTask', 'MyProject\Tools\CLI\Tasks\MyTask');
|
||||
*
|
||||
* To execute, just type any classify-able name:
|
||||
*
|
||||
@ -55,7 +55,7 @@ namespace Doctrine\Common\Cli;
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class CliController extends AbstractNamespace
|
||||
class CLIController extends AbstractNamespace
|
||||
{
|
||||
/**
|
||||
* The CLI processor of tasks
|
||||
@ -69,12 +69,12 @@ class CliController extends AbstractNamespace
|
||||
$this->setConfiguration($config);
|
||||
|
||||
// Include core namespaces of tasks
|
||||
$ns = 'Doctrine\Common\Cli\Tasks';
|
||||
$ns = 'Doctrine\Common\CLI\Tasks';
|
||||
$this->addNamespace('Core')
|
||||
->addTask('help', $ns . '\HelpTask')
|
||||
->addTask('version', $ns . '\VersionTask');
|
||||
|
||||
$ns = 'Doctrine\ORM\Tools\Cli\Tasks';
|
||||
$ns = 'Doctrine\ORM\Tools\CLI\Tasks';
|
||||
$this->addNamespace('Orm')
|
||||
->addTask('clear-cache', $ns . '\ClearCacheTask')
|
||||
->addTask('convert-mapping', $ns . '\ConvertMappingTask')
|
||||
@ -87,7 +87,7 @@ class CliController extends AbstractNamespace
|
||||
->addTask('generate-entities', $ns . '\GenerateEntitiesTask')
|
||||
->addTask('generate-repositories', $ns . '\GenerateRepositoriesTask');
|
||||
|
||||
$ns = 'Doctrine\DBAL\Tools\Cli\Tasks';
|
||||
$ns = 'Doctrine\DBAL\Tools\CLI\Tasks';
|
||||
$this->addNamespace('Dbal')
|
||||
->addTask('run-sql', $ns . '\RunSqlTask')
|
||||
->addTask('version', $ns . '\VersionTask');
|
||||
@ -98,12 +98,12 @@ class CliController extends AbstractNamespace
|
||||
* Example of inclusion support to a single task:
|
||||
*
|
||||
* [php]
|
||||
* $cli->addTask('my-custom-task', 'MyProject\Cli\Tasks\MyCustomTask');
|
||||
* $cli->addTask('my-custom-task', 'MyProject\CLI\Tasks\MyCustomTask');
|
||||
*
|
||||
* @param string $name CLI Task name
|
||||
* @param string $class CLI Task class (FQCN - Fully Qualified Class Name)
|
||||
*
|
||||
* @return CliController This object instance
|
||||
* @return CLIController This object instance
|
||||
*/
|
||||
public function addTask($name, $class)
|
||||
{
|
||||
@ -294,7 +294,7 @@ class CliController extends AbstractNamespace
|
||||
|
||||
// If the given namespace returned "null", throw exception
|
||||
if ($taskNamespace === null) {
|
||||
throw CliException::namespaceDoesNotExist($namespaceName, $currentNamespacePath);
|
||||
throw CLIException::namespaceDoesNotExist($namespaceName, $currentNamespacePath);
|
||||
}
|
||||
|
||||
$currentNamespacePath = (( ! empty($currentNamespacePath)) ? ':' : '')
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
/**
|
||||
* CLI Exception class
|
||||
@ -33,7 +33,7 @@ namespace Doctrine\Common\Cli;
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class CliException extends \Doctrine\Common\CommonException
|
||||
class CLIException extends \Exception
|
||||
{
|
||||
public static function namespaceDoesNotExist($namespaceName, $namespacePath = '')
|
||||
{
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
/**
|
||||
* CLI Configuration class
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
/**
|
||||
* CLI Option definition
|
@ -19,9 +19,9 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
use Doctrine\Common\Cli\Printers\AbstractPrinter;
|
||||
use Doctrine\Common\CLI\Printers\AbstractPrinter;
|
||||
|
||||
/**
|
||||
* CLI Option Group definition
|
@ -19,9 +19,9 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli\Printers;
|
||||
namespace Doctrine\Common\CLI\Printers;
|
||||
|
||||
use Doctrine\Common\Cli\Style;
|
||||
use Doctrine\Common\CLI\Style;
|
||||
|
||||
/**
|
||||
* CLI Output Printer.
|
@ -19,9 +19,9 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli\Printers;
|
||||
namespace Doctrine\Common\CLI\Printers;
|
||||
|
||||
use Doctrine\Common\Cli\Style;
|
||||
use Doctrine\Common\CLI\Style;
|
||||
|
||||
/**
|
||||
* CLI Output Printer for ANSI Color terminal
|
@ -19,9 +19,9 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli\Printers;
|
||||
namespace Doctrine\Common\CLI\Printers;
|
||||
|
||||
use Doctrine\Common\Cli\Style;
|
||||
use Doctrine\Common\CLI\Style;
|
||||
|
||||
/**
|
||||
* CLI Output Printer for Normal terminal
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
/**
|
||||
* CLI Output Style
|
@ -19,11 +19,11 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
use Doctrine\Common\Cli\Printers\AbstractPrinter,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
Doctrine\Common\Cli\Option;
|
||||
use Doctrine\Common\CLI\Printers\AbstractPrinter,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\Common\CLI\Option;
|
||||
|
||||
/**
|
||||
* CLI Task documentation
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli;
|
||||
namespace Doctrine\Common\CLI;
|
||||
|
||||
/**
|
||||
* CLI Namespace class
|
||||
@ -81,7 +81,7 @@ class TaskNamespace extends AbstractNamespace
|
||||
return new $taskClass($this);
|
||||
}
|
||||
|
||||
throw CliException::taskDoesNotExist($name, $this->getFullName());
|
||||
throw CLIException::taskDoesNotExist($name, $this->getFullName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,7 +129,7 @@ class TaskNamespace extends AbstractNamespace
|
||||
$name = self::formatName($name);
|
||||
|
||||
if ($this->hasTask($name)) {
|
||||
throw CliException::cannotOverrideTask($name);
|
||||
throw CLIException::cannotOverrideTask($name);
|
||||
}
|
||||
|
||||
return $this->overrideTask($name, $class);
|
||||
@ -228,7 +228,7 @@ class TaskNamespace extends AbstractNamespace
|
||||
} else if ($task->validate()) {
|
||||
$task->run();
|
||||
}
|
||||
} catch (CliException $e) {
|
||||
} catch (CLIException $e) {
|
||||
$message = $this->getFullName() . ':' . $name . ' => ' . $e->getMessage();
|
||||
$printer = $this->getPrinter();
|
||||
|
@ -19,10 +19,10 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli\Tasks;
|
||||
namespace Doctrine\Common\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\AbstractNamespace,
|
||||
Doctrine\Common\Cli\TaskDocumentation;
|
||||
use Doctrine\Common\CLI\AbstractNamespace,
|
||||
Doctrine\Common\CLI\TaskDocumentation;
|
||||
|
||||
/**
|
||||
* Base class for CLI Tasks.
|
@ -19,9 +19,9 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli\Tasks;
|
||||
namespace Doctrine\Common\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\CliException;
|
||||
use Doctrine\Common\CLI\CLIException;
|
||||
|
||||
/**
|
||||
* CLI Task to display available commands help
|
@ -19,7 +19,7 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cli\Tasks;
|
||||
namespace Doctrine\Common\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Version;
|
||||
|
@ -19,13 +19,13 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Tools\Cli\Tasks;
|
||||
namespace Doctrine\DBAL\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\CLIException,
|
||||
Doctrine\Common\Util\Debug,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup;
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup;
|
||||
|
||||
/**
|
||||
* Task for executing arbitrary SQL that can come from a file or directly from
|
||||
@ -78,13 +78,13 @@ class RunSqlTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ($em === null) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
"Attribute 'em' of CLI Configuration is not defined or it is not a valid EntityManager."
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! (isset($arguments['sql']) ^ isset($arguments['file']))) {
|
||||
throw new CliException('One of --sql or --file required, and only one.');
|
||||
throw new CLIException('One of --sql or --file required, and only one.');
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -107,9 +107,9 @@ class RunSqlTask extends AbstractTask
|
||||
|
||||
foreach ($fileNames as $fileName) {
|
||||
if ( ! file_exists($fileName)) {
|
||||
throw new CliException(sprintf('The SQL file [%s] does not exist.', $fileName));
|
||||
throw new CLIException(sprintf('The SQL file [%s] does not exist.', $fileName));
|
||||
} else if ( ! is_readable($fileName)) {
|
||||
throw new CliException(sprintf('The SQL file [%s] does not have read permissions.', $fileName));
|
||||
throw new CLIException(sprintf('The SQL file [%s] does not have read permissions.', $fileName));
|
||||
}
|
||||
|
||||
$printer->write('Processing file [' . $fileName . ']... ');
|
@ -19,9 +19,9 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Tools\Cli\Tasks;
|
||||
namespace Doctrine\DBAL\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\Version;
|
||||
|
||||
/**
|
@ -19,12 +19,12 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\CliException,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\Common\Cache\AbstractDriver;
|
||||
|
||||
/**
|
||||
@ -79,7 +79,7 @@ class ClearCacheTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ($em === null) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
"Attribute 'em' of CLI Configuration is not defined or it is not a valid EntityManager."
|
||||
);
|
||||
}
|
||||
@ -90,7 +90,7 @@ class ClearCacheTask extends AbstractTask
|
||||
(isset($arguments['query']) || isset($arguments['metadata'])) && (isset($arguments['id']) ||
|
||||
isset($arguments['regex']) || isset($arguments['prefix']) || isset($arguments['suffix']))
|
||||
) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
'When clearing the query or metadata cache do not ' .
|
||||
'specify any --id, --regex, --prefix or --suffix.'
|
||||
);
|
||||
@ -148,7 +148,7 @@ class ClearCacheTask extends AbstractTask
|
||||
$printer = $this->getPrinter();
|
||||
|
||||
if ( ! $cacheDriver) {
|
||||
throw new CliException('No driver has been configured for the ' . $type . ' cache.');
|
||||
throw new CLIException('No driver has been configured for the ' . $type . ' cache.');
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
@ -197,7 +197,7 @@ class ClearCacheTask extends AbstractTask
|
||||
$printer->writeln(' - ' . $id);
|
||||
}
|
||||
} else {
|
||||
throw new CliException('No ' . $type . ' cache entries found.');
|
||||
throw new CLIException('No ' . $type . ' cache entries found.');
|
||||
}
|
||||
|
||||
$printer->write(PHP_EOL);
|
@ -19,13 +19,13 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\ORM\Tools\Export\ClassMetadataExporter,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
Doctrine\Common\CLI\CliException,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\ORM\Tools\ConvertDoctrine1Schema,
|
||||
Doctrine\ORM\Tools\EntityGenerator;
|
||||
|
||||
@ -70,7 +70,7 @@ class ConvertDoctrine1SchemaTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ( ! isset($arguments['from']) || ! isset($arguments['to']) || ! isset($arguments['dest'])) {
|
||||
throw new CliException('You must specify a value for --from, --to and --dest');
|
||||
throw new CLIException('You must specify a value for --from, --to and --dest');
|
||||
}
|
||||
|
||||
return true;
|
@ -19,12 +19,12 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\CliException,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\ORM\Tools\Export\ClassMetadataExporter,
|
||||
Doctrine\ORM\Mapping\Driver\DriverChain,
|
||||
Doctrine\ORM\Mapping\Driver\AnnotationDriver,
|
||||
@ -78,13 +78,13 @@ class ConvertMappingTask extends AbstractTask
|
||||
}
|
||||
|
||||
if (!(isset($arguments['from']) && isset($arguments['to']) && isset($arguments['dest']))) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
'You must include a value for all three options: --from, --to and --dest.'
|
||||
);
|
||||
}
|
||||
|
||||
if (strtolower($arguments['to']) != 'annotation' && isset($arguments['extend'])) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
'You can only use the --extend argument when converting to annotations.'
|
||||
);
|
||||
}
|
||||
@ -94,7 +94,7 @@ class ConvertMappingTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ($em === null) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
"Attribute 'em' of CLI Configuration is not defined or it is not a valid EntityManager."
|
||||
);
|
||||
}
|
@ -19,10 +19,10 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\CliException;
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\CLIException;
|
||||
|
||||
/**
|
||||
* CLI Task to ensure that Doctrine is properly configured for a production environment.
|
||||
@ -57,7 +57,7 @@ class EnsureProductionSettingsTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ($em === null) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
"Attribute 'em' of CLI Configuration is not defined or it is not a valid EntityManager."
|
||||
);
|
||||
}
|
@ -19,12 +19,12 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\Common\CLI\CLIException,
|
||||
Doctrine\ORM\Tools\EntityGenerator,
|
||||
Doctrine\ORM\Tools\ClassMetadataReader;
|
||||
|
||||
@ -67,7 +67,7 @@ class GenerateEntitiesTask extends AbstractTask
|
||||
$arguments = $this->getArguments();
|
||||
|
||||
if ( ! isset($arguments['from']) || ! isset($arguments['dest'])) {
|
||||
throw new CliException('You must specify a value for --from and --dest');
|
||||
throw new CLIException('You must specify a value for --from and --dest');
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -110,7 +110,7 @@ class GenerateEntitiesTask extends AbstractTask
|
||||
|
||||
$entityGenerator->generate($metadatas, $dest);
|
||||
|
||||
$printer->writeln('');
|
||||
$printer->write(PHP_EOL);
|
||||
$printer->writeln(
|
||||
sprintf('Entity classes generated to "%s"',
|
||||
$printer->format($dest, 'KEYWORD')
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup;
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\CLIException,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup;
|
||||
|
||||
/**
|
||||
* Task to (re)generate the proxy classes used by doctrine.
|
||||
@ -50,7 +50,7 @@ class GenerateProxiesTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ($em === null) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
"Attribute 'em' of CLI Configuration is not defined or it is not a valid EntityManager."
|
||||
);
|
||||
}
|
||||
@ -61,7 +61,7 @@ class GenerateProxiesTask extends AbstractTask
|
||||
if (isset($arguments['class-dir'])) {
|
||||
$metadataDriver->addPaths((array) $arguments['class-dir']);
|
||||
} else {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
'The supplied configuration uses the annotation metadata driver. ' .
|
||||
"The 'class-dir' argument is required for this driver."
|
||||
);
|
@ -19,12 +19,12 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\Common\CLI\CLIException,
|
||||
Doctrine\ORM\Tools\ClassMetadataReader;
|
||||
|
||||
/**
|
||||
@ -84,7 +84,7 @@ class <className> extends EntityRepository
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ( ! isset($arguments['from']) || ! isset($arguments['dest'])) {
|
||||
throw new CliException('You must specify a value for --from and --dest');
|
||||
throw new CLIException('You must specify a value for --from and --dest');
|
||||
}
|
||||
|
||||
return true;
|
@ -19,13 +19,13 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\CLIException,
|
||||
Doctrine\Common\Util\Debug,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\ORM\Query;
|
||||
|
||||
/**
|
||||
@ -90,29 +90,29 @@ class RunDqlTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ($em === null) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
"Attribute 'em' of CLI Configuration is not defined or it is not a valid EntityManager."
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! isset($arguments['dql'])) {
|
||||
throw new CliException('Argument --dql must be defined.');
|
||||
throw new CLIException('Argument --dql must be defined.');
|
||||
}
|
||||
|
||||
if (isset($arguments['hydrate'])) {
|
||||
$hydrationModeName = 'Doctrine\ORM\Query::HYDRATE_' . strtoupper(str_replace('-', '_', $arguments['hydrate']));
|
||||
|
||||
if ( ! defined($hydrationModeName)) {
|
||||
throw new CliException("Argument --hydrate must be either 'object', 'array', 'scalar' or 'single-scalar'.");
|
||||
throw new CLIException("Argument --hydrate must be either 'object', 'array', 'scalar' or 'single-scalar'.");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arguments['first-result']) && ! ctype_digit($arguments['first-result'])) {
|
||||
throw new CliException('Argument --first-result must be an integer value.');
|
||||
throw new CLIException('Argument --first-result must be an integer value.');
|
||||
}
|
||||
|
||||
if (isset($arguments['max-results']) && ! ctype_digit($arguments['max-results'])) {
|
||||
throw new CliException('Argument --max-results must be an integer value.');
|
||||
throw new CLIException('Argument --max-results must be an integer value.');
|
||||
}
|
||||
|
||||
return true;
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
Doctrine\Common\Cli\CliException,
|
||||
Doctrine\Common\Cli\Option,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\CLI\CLIException,
|
||||
Doctrine\Common\CLI\Option,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\ORM\Tools\SchemaTool,
|
||||
Doctrine\Common\Annotations\AnnotationReader,
|
||||
Doctrine\ORM\Mapping\Driver\AnnotationDriver,
|
||||
@ -105,7 +105,7 @@ class SchemaToolTask extends AbstractTask
|
||||
$em = $this->getConfiguration()->getAttribute('em');
|
||||
|
||||
if ($em === null) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
"Attribute 'em' of CLI Configuration is not defined or it is not a valid EntityManager."
|
||||
);
|
||||
}
|
||||
@ -125,17 +125,17 @@ class SchemaToolTask extends AbstractTask
|
||||
$isCompleteUpdate = isset($arguments['complete-update']) && $arguments['complete-update'];
|
||||
|
||||
if ($isUpdate && ($isCreate || $isDrop || $isCompleteUpdate)) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
'You cannot use --update with --create, --drop or --complete-update.'
|
||||
);
|
||||
}
|
||||
|
||||
if ($isCompleteUpdate && ($isCreate || $isDrop || $isUpdate)) {
|
||||
throw new CliException('You cannot use --complete-update with --create, --drop or --update.');
|
||||
throw new CLIException('You cannot use --complete-update with --create, --drop or --update.');
|
||||
}
|
||||
|
||||
if ( ! ($isCreate || $isDrop || $isUpdate || $isCompleteUpdate)) {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
'You must specify at a minimum one of the options: ' .
|
||||
'--create, --drop, --update, --re-create or --complete-update.'
|
||||
);
|
||||
@ -147,7 +147,7 @@ class SchemaToolTask extends AbstractTask
|
||||
if (isset($arguments['class-dir'])) {
|
||||
$metadataDriver->addPaths((array) $arguments['class-dir']);
|
||||
} else {
|
||||
throw new CliException(
|
||||
throw new CLIException(
|
||||
'The supplied configuration uses the annotation metadata driver. ' .
|
||||
"The 'class-dir' argument is required for this driver."
|
||||
);
|
@ -19,9 +19,9 @@
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\ORM\Tools\Cli\Tasks;
|
||||
namespace Doctrine\ORM\Tools\CLI\Tasks;
|
||||
|
||||
use Doctrine\Common\Cli\Tasks\AbstractTask,
|
||||
use Doctrine\Common\CLI\Tasks\AbstractTask,
|
||||
Doctrine\Common\Version;
|
||||
|
||||
/**
|
@ -29,7 +29,7 @@ class AllTests
|
||||
$suite->addTest(Collections\AllTests::suite());
|
||||
$suite->addTest(Annotations\AllTests::suite());
|
||||
$suite->addTest(Cache\AllTests::suite());
|
||||
$suite->addTest(Cli\AllTests::suite());
|
||||
$suite->addTest(CLI\AllTests::suite());
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cli;
|
||||
namespace Doctrine\Tests\Common\CLI;
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD')) {
|
||||
define('PHPUnit_MAIN_METHOD', 'Common_Cli_AllTests::main');
|
||||
@ -19,16 +19,16 @@ class AllTests
|
||||
{
|
||||
$suite = new \Doctrine\Tests\DoctrineTestSuite('Doctrine Common CLI Tests');
|
||||
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\Cli\ConfigurationTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\Cli\OptionTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\Cli\OptionGroupTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\Cli\StyleTest');
|
||||
//$suite->addTestSuite('Doctrine\Tests\Common\Cli\CliControllerTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\CLI\ConfigurationTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\CLI\OptionTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\CLI\OptionGroupTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\Common\CLI\StyleTest');
|
||||
//$suite->addTestSuite('Doctrine\Tests\Common\CLI\CLIControllerTest');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'Common_Cli_AllTests::main') {
|
||||
if (PHPUnit_MAIN_METHOD == 'Common_CLI_AllTests::main') {
|
||||
AllTests::main();
|
||||
}
|
@ -1,31 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cli;
|
||||
namespace Doctrine\Tests\Common\CLI;
|
||||
|
||||
use Doctrine\Tests\Mocks\TaskMock;
|
||||
use Doctrine\Common\Cli\Configuration;
|
||||
use Doctrine\Common\Cli\CliController;
|
||||
use Doctrine\Common\CLI\Configuration;
|
||||
use Doctrine\Common\CLI\CliController;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class CliControllerTest extends \Doctrine\Tests\DoctrineTestCase
|
||||
class CLIControllerTest extends \Doctrine\Tests\DoctrineTestCase
|
||||
{
|
||||
private $cli;
|
||||
|
||||
/**
|
||||
* Sets up a CliController instance with a task referencing the TaskMock
|
||||
* class. Instances of that class created by the CliController can be
|
||||
* Sets up a CLIController instance with a task referencing the TaskMock
|
||||
* class. Instances of that class created by the CLIController can be
|
||||
* inspected for correctness.
|
||||
*/
|
||||
function setUp()
|
||||
{
|
||||
$config = $this->getMock('\Doctrine\Common\Cli\Configuration');
|
||||
$printer = $this->getMockForAbstractClass('\Doctrine\Common\Cli\Printers\AbstractPrinter');
|
||||
$config = $this->getMock('\Doctrine\Common\CLI\Configuration');
|
||||
$printer = $this->getMockForAbstractClass('\Doctrine\Common\CLI\Printers\AbstractPrinter');
|
||||
|
||||
$this->cli = new CliController($config, $printer);
|
||||
$this->cli = new CLIController($config, $printer);
|
||||
|
||||
TaskMock::$instances = array();
|
||||
|
||||
@ -36,7 +36,7 @@ class CliControllerTest extends \Doctrine\Tests\DoctrineTestCase
|
||||
* Data provider with a bunch of task-mock calls with different arguments
|
||||
* and their expected parsed format.
|
||||
*/
|
||||
static public function dataCliControllerArguments()
|
||||
static public function dataCLIControllerArguments()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@ -69,9 +69,9 @@ class CliControllerTest extends \Doctrine\Tests\DoctrineTestCase
|
||||
|
||||
/**
|
||||
* Checks whether the arguments coming from the data provider are correctly
|
||||
* parsed by the CliController and passed to the task to be run.
|
||||
* parsed by the CLIController and passed to the task to be run.
|
||||
*
|
||||
* @dataProvider dataCliControllerArguments
|
||||
* @dataProvider dataCLIControllerArguments
|
||||
* @param array $rawArgs
|
||||
* @param array $parsedArgs
|
||||
* @param string $message
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cli;
|
||||
namespace Doctrine\Tests\Common\CLI;
|
||||
|
||||
use Doctrine\Common\Cli\Configuration;
|
||||
use Doctrine\Common\CLI\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cli;
|
||||
namespace Doctrine\Tests\Common\CLI;
|
||||
|
||||
use Doctrine\Common\Cli\Printers\NormalPrinter,
|
||||
Doctrine\Common\Cli\OptionGroup,
|
||||
Doctrine\Common\Cli\Option;
|
||||
use Doctrine\Common\CLI\Printers\NormalPrinter,
|
||||
Doctrine\Common\CLI\OptionGroup,
|
||||
Doctrine\Common\CLI\Option;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cli;
|
||||
namespace Doctrine\Tests\Common\CLI;
|
||||
|
||||
use Doctrine\Common\Cli\Option;
|
||||
use Doctrine\Common\CLI\Option;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cli;
|
||||
namespace Doctrine\Tests\Common\CLI;
|
||||
|
||||
use Doctrine\Common\Cli\Style;
|
||||
use Doctrine\Common\CLI\Style;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
@ -37,5 +37,5 @@ $connectionOptions = array(
|
||||
|
||||
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
|
||||
|
||||
$configuration = new \Doctrine\Common\Cli\Configuration();
|
||||
$configuration = new \Doctrine\Common\CLI\Configuration();
|
||||
$configuration->setAttribute('em', $em);
|
@ -8,5 +8,5 @@ $classLoader->register();
|
||||
// Variable $configuration is defined inside cli-config.php
|
||||
require __DIR__ . '/cli-config.php';
|
||||
|
||||
$cli = new \Doctrine\Common\Cli\CliController($configuration);
|
||||
$cli = new \Doctrine\Common\CLI\CLIController($configuration);
|
||||
$cli->run($_SERVER['argv']);
|
Loading…
Reference in New Issue
Block a user