ConsoleProgressHelper example

->setDescription('Refreshes the search index for the customer search')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $query = $this->createQuery();

        $helper = new ConsoleProgressHelper($output);
        $helper->start($query->fetchCount(), 'Start indexing stream search data');

        $this->container->get(\Doctrine\DBAL\Connection::class)->transactional(
            function D) use ($helper$query) {
                $this->container->get(\Doctrine\DBAL\Connection::class)->executeUpdate('DELETE FROM s_customer_search_index');

                $indexer = $this->container->get(\Shopware\Bundle\CustomerSearchBundleDBAL\Indexing\SearchIndexerInterface::class);

                while ($ids = $query->fetch()) {
                    $indexer->populate($ids);
                    $helper->advance(\count($ids));
                }

    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var EsBackendIndexer $indexer */
        $indexer = $this->container->get('shopware_es_backend.indexer');

        $helper = new ConsoleProgressHelper($output);
        $evaluation = $this->container->get(\Shopware\Bundle\ESIndexingBundle\Console\EvaluationHelperInterface::class);
        $evaluation->setOutput($output)
            ->setActive(!$input->getOption('no-evaluation'))
            ->setStopOnError($input->getOption('stop-on-error'));

        $indexer->index($helper);

        return 0;
    }
}
->addOption('index', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'The index to populate')
            ->addOption('no-evaluation', null, InputOption::VALUE_NONE, 'Disable evaluation for each index')
            ->addOption('stop-on-error', null, InputOption::VALUE_NONE, 'Abort indexing if an error occurs')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $helper = new ConsoleProgressHelper($output);

        $this->evaluationHelper->setOutput($output);
        $this->evaluationHelper->setActive(!$input->getOption('no-evaluation'));
        $this->evaluationHelper->setStopOnError($input->getOption('stop-on-error'));

        foreach ($this->getShops($input$output) as $shop) {
            $output->writeln("\n## Indexing shop " . $shop->getName() . ' ##');
            $this->shopIndexer->index($shop$helper$input->getOption('index'));
        }

        return 0;
    }
Home | Imprint | This part of the site doesn't use cookies.