Merge pull request #108 from pdaether/2.0
New Option "no-reset" for the populate command
This commit is contained in:
commit
6aa96dd227
9
Command/PopulateCommand.php
Normal file → Executable file
9
Command/PopulateCommand.php
Normal file → Executable file
|
@ -21,7 +21,8 @@ class PopulateCommand extends ContainerAwareCommand
|
|||
{
|
||||
$this
|
||||
->setName('foq:elastica:populate')
|
||||
->setDescription('Populates search indexes from providers');
|
||||
->setDescription('Populates search indexes from providers')
|
||||
->addOption('no-reset', null, InputOption::VALUE_NONE, 'If set, the indexes will not been resetted before populating.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,8 +30,10 @@ class PopulateCommand extends ContainerAwareCommand
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$output->writeln('Resetting indexes');
|
||||
$this->getContainer()->get('foq_elastica.reseter')->reset();
|
||||
if (!$input->getOption('no-reset')) {
|
||||
$output->writeln('Resetting indexes');
|
||||
$this->getContainer()->get('foq_elastica.reseter')->reset();
|
||||
}
|
||||
|
||||
$output->writeln('Populating indexes');
|
||||
$this->getContainer()->get('foq_elastica.populator')->populate(function($text) use ($output) {
|
||||
|
|
Loading…
Reference in a new issue