getLastBacklogId example

$this
            ->setName('sw:es:backlog:clear')
            ->setDescription('Remove backlog entries that are already synchronized.')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $lastId = $this->container->get(\Shopware\Bundle\ESIndexingBundle\BacklogReader::class)->getLastBacklogId();

        $this->container->get(\Doctrine\DBAL\Connection::class)->executeUpdate('DELETE FROM s_es_backlog WHERE id <= :id', [':id' => $lastId]);

        return 0;
    }
}
$this->settings = $settings;
        $this->evaluation = $evaluation;
    }

    /** * {@inheritdoc} * * @throws RuntimeException */
    public function index(Shop $shop, ProgressHelperInterface $helper, ?array $indexNames = null)
    {
        $lastBacklogId = $this->backlogReader->getLastBacklogId();

        foreach ($this->mappings as $mapping) {
            if (!empty($indexNames) && !\in_array($mapping->getType()$indexNames)) {
                continue;
            }

            $configuration = $this->indexFactory->createIndexConfiguration($shop$mapping->getType());
            $shopIndex = new ShopIndex($configuration->getName()$shop$mapping->getType());

            $this->createIndex($configuration$shopIndex);
            $this->updateMapping($shopIndex$mapping);
            

        $this
            ->setName('sw:es:backlog:sync')
            ->setDescription('Synchronize events from the backlog to the live index.');
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $lastBackLogId = $this->backlogReader->getLastBacklogId();
        $backlogs = $this->backlogReader->read($lastBackLogId$this->batchSize);

        $output->writeln(sprintf('Current last backlog id: %d', $lastBackLogId));

        $io = new SymfonyStyle($input$output);

        if (empty($backlogs)) {
            $io->success('Backlog is empty');

            return 0;
        }

        
Home | Imprint | This part of the site doesn't use cookies.