[ACCEPTED]-Doctrine load fixtures --no-interaction flag is not working when running in a Symfony command-fixtures
Accepted answer
I've found the solution. Simply call:
$input->setInteractive(false);
Like 1 so:
protected function loadFixturesCommand($oOutput) {
$oOutput->writeln('<fg=white>Attempting to load fixtures</fg=white>');
$updateCommand = $this->getApplication()->find('doctrine:fixtures:load');
$updateArguments = array(
'command' => 'doctrine:fixtures:load'
);
$updateInput = new ArrayInput($updateArguments);
$updateInput->setInteractive(false);
$updateCommand->run($updateInput, $oOutput);
try {
$updateCommand->run($updateInput, $oOutput);
} catch (ContextErrorException $e) {
//..
}
return $this;
}
You can use --append
param to suppress interaction.
i.e. doctrine:fixtures:load --append
0
If you make a drop from your database you 6 could also use this command I think, to 5 be confirmed.
By default Doctrine Data Fixtures 4 uses DELETE statements to drop the existing 3 rows from the database. If you want to use 2 a TRUNCATE statement instead you can use 1 the --purge-with-truncate flag:
php bin/console doctrine:fixtures:load --purge-with-truncate
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.