diff --git a/Command/LoadDataFixturesDoctrineCommand.php b/Command/LoadDataFixturesDoctrineCommand.php index 08b327b7..ffc4b91d 100644 --- a/Command/LoadDataFixturesDoctrineCommand.php +++ b/Command/LoadDataFixturesDoctrineCommand.php @@ -65,6 +65,7 @@ protected function configure() ->addOption('purge-exclusions', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'List of database tables to ignore while purging') ->addOption('shard', null, InputOption::VALUE_REQUIRED, 'The shard connection to use for this command.') ->addOption('purge-with-truncate', null, InputOption::VALUE_NONE, 'Purge data by using a database-level TRUNCATE statement') + ->addOption('allow-no-fixture', null, InputOption::VALUE_NONE, 'Do not throw an exception if no fixture is available.') ->setHelp(<<%command.name% command loads data fixtures from your application: @@ -125,7 +126,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $message .= sprintf(' in the groups (%s)', implode(', ', $groups)); } - $ui->error($message . '.'); + $message .= '.'; + + if ($input->getOption('allow-no-fixture')) { + $ui->warning($message); + + return 0; + } + + $ui->error($message); return 1; }