浏览代码

no-backup option instead of force, cleaned comparison operator

mcben 14 年之前
父节点
当前提交
512eb5378a

+ 5 - 5
src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php

@@ -32,7 +32,7 @@ class GenerateEntitiesDoctrineCommand extends DoctrineCommand
             ->setDescription('Generate entity classes and method stubs from your mapping information')
             ->addArgument('name', InputArgument::REQUIRED, 'A bundle name, a namespace, or a class name')
             ->addOption('path', null, InputOption::VALUE_REQUIRED, 'The path where to generate entities when it cannot be guessed')
-            ->addOption('force', null, InputOption::VALUE_NONE, 'Force to overwrite existing entities files.')
+            ->addOption('no-backup', null, InputOption::VALUE_NONE, 'Do not backup existing entities files.')
             ->addOption('annotate', null, InputOption::VALUE_NONE, 'Should we annotate generated entity classes')
             ->setHelp(<<<EOT
 The <info>doctrine:generate:entities</info> command generates entity classes
@@ -59,10 +59,10 @@ you must provide the <comment>--path</comment> option:
 
   <info>./app/console doctrine:generate:entities Blog/Entity --path=src/</info>
 
-You should provide the <comment>--force</comment> option if you dont mind to back up files
+You should provide the <comment>--no-backup</comment> option if you dont mind to back up files
 before to generate entities:
 
-  <info>./app/console doctrine:generate:entities Blog/Entity --force</info>
+  <info>./app/console doctrine:generate:entities Blog/Entity --no-backup</info>
 
 If you want that generated entity classes are annotated with ORM mapping,
 you can provide the <comment>--annotate</comment> option:
@@ -97,8 +97,8 @@ EOT
         }
 
         $generator = $this->getEntityGenerator();
-        $generator->setGenerateAnnotations(($input->getOption('annotate') !== false));
-        $generator->setBackupExisting(($input->getOption('force') === true));
+        $generator->setGenerateAnnotations($input->getOption('annotate'));
+        $generator->setBackupExisting(!$input->getOption('no-backup'));
         $repoGenerator = new EntityRepositoryGenerator();
         foreach ($metadatas as $metadata) {
             $output->writeln(sprintf('  > generating <comment>%s</comment>', $metadata->name));

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php

@@ -79,7 +79,7 @@ EOT
 
         $cme = new ClassMetadataExporter();
         $exporter = $cme->getExporter($type);
-        $exporter->setOverwriteExistingFiles(($input->getOption('force') !== false));
+        $exporter->setOverwriteExistingFiles($input->getOption('force'));
 
         if ('annotation' === $type) {
             $entityGenerator = $this->getEntityGenerator();