Skip to content

Commit

Permalink
Allow option to exclude purged tables/views
Browse files Browse the repository at this point in the history
  • Loading branch information
Zul3s committed Sep 1, 2020
1 parent a2179f4 commit 0db0208
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Command/LoadDataFixturesDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ protected function configure()
->addOption('em', null, InputOption::VALUE_REQUIRED, 'The entity manager to use for this command.')
->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('purge-excluded', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_OPTIONAL, 'Table/view names to be excleded from purge')
->setHelp(<<<EOT
The <info>%command.name%</info> command loads data fixtures from your application:
Expand Down Expand Up @@ -118,7 +119,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

return 1;
}
$purger = new ORMPurger($em);
$excluded = $input->getOption('purge-excluded');
$purger = new ORMPurger($em, $excluded);
$purger->setPurgeMode($input->getOption('purge-with-truncate') ? ORMPurger::PURGE_MODE_TRUNCATE : ORMPurger::PURGE_MODE_DELETE);
$executor = new ORMExecutor($em, $purger);
$executor->setLogger(static function ($message) use ($ui) : void {
Expand Down

0 comments on commit 0db0208

Please sign in to comment.