Command/ReindexCommand.php
protected function dropIndex(IndexerInterface $indexer, InputInterface $input, OutputInterface $output)
    {
        if (!$input->getOption('drop')) {
            return true;
        }

        if (!$input->getOption('no-interaction')) {
            $output->writeln(
                '<comment>ATTENTION</comment>: This operation drops and recreates the whole index and deletes the complete data.'
            );
            $output->writeln('');

            $question = new ConfirmationQuestion('Are you sure you want to drop the index? [Y/n] ');

            /** @var QuestionHelper $questionHelper */
            $questionHelper = $this->getHelper('question');
            if (!$questionHelper->ask($input, $output, $question)) {
                return false;
            }

            $output->writeln('');
        }

        $indexer->dropIndex();

        $context = $this->getContainer()->getParameter('sulu.context');
        $output->writeln(
            sprintf('Dropped and recreated index for the <comment>`%s`</comment> context' . PHP_EOL, $context)
        );

        return true;
    }
protected function dropIndex(IndexerInterface $indexer, InputInterface $input, OutputInterface $output)
    {
        if (!$input->getOption('drop')) {
            return true;
        }

        if (!$input->getOption('no-interaction')) {
            $output->writeln(
                '<comment>ATTENTION</comment>: This operation drops and recreates the whole index and deletes the complete data.'
            );
            $output->writeln('');

            $question = new ConfirmationQuestion('Are you sure you want to drop the index? [Y/n] ');

            /** @var QuestionHelper $questionHelper */
            $questionHelper = $this->getHelper('question');
            if (!$questionHelper->ask($input, $output, $question)) {
                return false;
            }

            $output->writeln('');
        }

        $indexer->dropIndex();

        $context = $this->getContainer()->getParameter('sulu.context');
        $output->writeln(
            sprintf('Dropped and recreated index for the <comment>`%s`</comment> context' . PHP_EOL, $context)
        );

        return true;
    }
protected function dropIndex ( IndexerInterface $ indexer , InputInterface $ input , OutputInterface $ output ) { if ( ! $ input -> getOption ( 'drop' ) ) { return true ; } if ( ! $ input -> getOption ( 'no-interaction' ) ) { $ output -> writeln ( '<comment>ATTENTION</comment>: This operation drops and recreates the whole index and deletes the complete data.' ) ; $ output -> writeln ( '' ) ; $ question = new ConfirmationQuestion ( 'Are you sure you want to drop the index? [Y/n] ' ) ; /** @var QuestionHelper $questionHelper */ $ questionHelper = $ this -> getHelper ( 'question' ) ; if ( ! $ questionHelper -> ask ( $ input , $ output , $ question ) ) { return false ; } $ output -> writeln ( '' ) ; } $ indexer -> dropIndex ( ) ; $ context = $ this -> getContainer ( ) -> getParameter ( 'sulu.context' ) ; $ output -> writeln ( sprintf ( 'Dropped and recreated index for the <comment>`%s`</comment> context' . PHP_EOL , $ context ) ) ; return true ; }
Drop index if requested.

@param IndexerInterface $indexer
@param InputInterface $input
@param OutputInterface $output

@return bool
Drop index if requested .