/**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $index = $input->getOption('index');
     $type = $input->getOption('type');
     $reset = !$input->getOption('no-reset');
     $options = array('ignore_errors' => $input->getOption('ignore-errors'), 'offset' => $input->getOption('offset'), 'sleep' => $input->getOption('sleep'));
     if ($input->getOption('batch-size')) {
         $options['batch_size'] = (int) $input->getOption('batch-size');
     }
     if ($input->isInteractive() && $reset && $input->getOption('offset')) {
         /** @var QuestionHelper $dialog */
         $dialog = $this->getHelperSet()->get('question');
         if (!$dialog->askConfirmation($input, $output, new Question('<question>You chose to reset the index and start indexing with an offset. Do you really want to do that?</question>'))) {
             return;
         }
     }
     if (null === $index && null !== $type) {
         throw new \InvalidArgumentException('Cannot specify type option without an index.');
     }
     if (null !== $index) {
         if (null !== $type) {
             $this->populateIndexType($output, $index, $type, $reset, $options);
         } else {
             $this->populateIndex($output, $index, $reset, $options);
         }
     } else {
         $indexes = array_keys($this->indexManager->getAllIndexes());
         foreach ($indexes as $index) {
             $this->populateIndex($output, $index, $reset, $options);
         }
     }
 }
 /**
  * @see Symfony\Component\Console\Command\Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $index = $input->getOption('index');
     $type = $input->getOption('type');
     $force = (bool) $input->getOption('force');
     if (null === $index && null !== $type) {
         throw new \InvalidArgumentException('Cannot specify type option without an index.');
     }
     if (null !== $type) {
         $output->writeln(sprintf('<info>Resetting</info> <comment>%s/%s</comment>', $index, $type));
         $this->resetter->resetIndexType($index, $type);
     } else {
         $indexes = null === $index ? array_keys($this->indexManager->getAllIndexes()) : array($index);
         foreach ($indexes as $index) {
             $output->writeln(sprintf('<info>Resetting</info> <comment>%s</comment>', $index));
             $this->resetter->resetIndex($index, false, $force);
         }
     }
 }
 public function testGetAllIndexes()
 {
     $this->assertEquals($this->indexes, $this->indexManager->getAllIndexes());
 }