indexStream example

'finish' => true,
                'progress' => 1,
                'text' => $snippets->get('stream_refreshed'),
            ]);

            return;
        }

        $iteration = (int) $this->Request()->getParam('iteration', 1);
        $offset = ($iteration - 1) * CustomerStreamRepository::INDEXING_LIMIT;

        $this->getApiResource()->indexStream($stream$offset, CustomerStreamRepository::INDEXING_LIMIT);

        $handled = $offset + CustomerStreamRepository::INDEXING_LIMIT;

        if ($handled >= $total) {
            $this->View()->assign([
                'success' => true,
                'finish' => true,
                'progress' => 1,
                'text' => $snippets->get('stream_refreshed'),
            ]);

            

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $streamIds = [];
        if ($streamId = $input->getOption('streamId')) {
            $streamIds = [$streamId];
        }
        $streams = $this->getStreams($streamIds);

        foreach ($streams as $stream) {
            $output->writeln("\n## Indexing Customer Stream: " . $stream->getName() . ' ##');
            $this->container->get(\Shopware\Components\Api\Resource\CustomerStream::class)->indexStream($stream);
        }

        return 0;
    }

    /** * @param array<int> $ids * * @return CustomerStream[] */
    private function getStreams(array $ids = []): array
    {
$violations = $this->getManager()->validate($stream);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->validateStream($stream);

        $this->getManager()->persist($stream);
        $this->getManager()->flush($stream);

        if ($index) {
            $this->indexStream($stream);
        }

        if (\array_key_exists('customers', $data) && $stream->isStatic()) {
            $this->insertCustomers($data['customers']$stream->getId());
        }

        return $stream;
    }

    /** * @param int $id * @param bool $index * * @throws NotFoundException * @throws ParameterMissingException * @throws ValidationException * * @return CustomerStreamEntity */
Home | Imprint | This part of the site doesn't use cookies.