Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --allow-no-fixture option #337

Open
wants to merge 3 commits into
base: 3.4.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion Command/LoadDataFixturesDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(<<<EOT
The <info>%command.name%</info> command loads data fixtures from your application:

Expand Down Expand Up @@ -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;
}
Expand Down