From becc902864e150b4c0b378effbcd68f1f12678a6 Mon Sep 17 00:00:00 2001 From: pdaether Date: Mon, 7 May 2012 17:48:06 +0200 Subject: [PATCH] New Option no-reset for the populate command --- Command/PopulateCommand.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) mode change 100644 => 100755 Command/PopulateCommand.php diff --git a/Command/PopulateCommand.php b/Command/PopulateCommand.php old mode 100644 new mode 100755 index f48acf5..70ff5ea --- a/Command/PopulateCommand.php +++ b/Command/PopulateCommand.php @@ -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) {