/** * @see Symfony\Component\Console\Command\Command::execute() */ protected function execute(InputInterface $input, OutputInterface $output) { $index = $input->getOption('index'); $type = $input->getOption('type'); $reset = !$input->getOption('no-reset'); $options = $input->getOptions(); $options['ignore-errors'] = $input->hasOption('ignore-errors'); if ($input->isInteractive() && $reset && $input->getOption('offset')) { /** @var DialogHelper $dialog */ $dialog = $this->getHelperSet()->get('dialog'); if (!$dialog->askConfirmation($output, '<question>You chose to reset the index and start indexing with an offset. Do you really want to do that?</question>', true)) { 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'); $force = (bool) $input->getOption('force'); $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); } }
/** * @see Symfony\Component\Console\Command\Command::execute() */ protected function execute(InputInterface $input, OutputInterface $output) { $index = $input->getOption('index'); $type = $input->getOption('type'); 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); } } }
public function testGetAllIndexes() { $this->assertEquals($this->indexesByName, $this->indexManager->getAllIndexes()); }