Skip to content

Commit

Permalink
no-backup option instead of force, cleaned comparison operator
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbennn committed May 25, 2011
1 parent 6504797 commit 512eb53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -32,7 +32,7 @@ protected function configure()
->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
Expand All @@ -59,10 +59,10 @@ protected function configure()
<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:
Expand Down Expand Up @@ -97,8 +97,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

$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));
Expand Down
Expand Up @@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$cme = new ClassMetadataExporter();
$exporter = $cme->getExporter($type);
$exporter->setOverwriteExistingFiles(($input->getOption('force') !== false));
$exporter->setOverwriteExistingFiles($input->getOption('force'));

if ('annotation' === $type) {
$entityGenerator = $this->getEntityGenerator();
Expand Down

0 comments on commit 512eb53

Please sign in to comment.