An error is raised if no valid bundle name is given to the FormGenerate command

This commit is contained in:
Kévin Gomez 2014-04-19 05:06:13 +01:00
commit 3af6f656a7

View file

@ -43,7 +43,7 @@ class FormGenerateCommand extends AbstractCommand
->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite existing Form types')
->addOption('platform', null, InputOption::VALUE_REQUIRED, 'The platform', BaseCommand::DEFAULT_PLATFORM)
->addArgument('bundle', InputArgument::REQUIRED, 'The bundle to use to generate Form types')
->addArgument('bundle', InputArgument::REQUIRED, 'The bundle to use to generate Form types (Ex: @AcmeDemoBundle)')
->addArgument('models', InputArgument::IS_ARRAY, 'Model classes to generate Form Types from')
->setHelp(<<<EOT
@ -65,6 +65,10 @@ EOT
$models = $input->getArgument('models');
$force = $input->getOption('force');
if (!$this->bundle) {
throw new \InvalidArgumentException('No valid bundle given');
}
$this->setupBuildTimeFiles();
if (!($schemas = $this->getFinalSchemas($kernel, $this->bundle))) {