clearStreamIndex example


    public function populate($streamId, ProgressHelperInterface $helper)
    {
        $this->connection->transactional(function D) use ($streamId$helper) {
            $criteria = $this->criteriaFactory->createCriteria($streamId);
            $criteria->offset(0)
                ->limit(100);

            $customers = $this->numberSearch->search($criteria);
            $helper->start($customers->getTotal(), 'Start indexing customers');

            $this->clearStreamIndex($streamId);

            $insert = $this->connection->prepare(
                'INSERT INTO s_customer_streams_mapping (stream_id, customer_id) VALUES (:streamId, :customerId)'
            );

            while ($customers->getCustomers()) {
                foreach ($customers->getIds() as $customerId) {
                    $insert->execute([
                        ':streamId' => $streamId,
                        ':customerId' => $customerId,
                    ]);
                }
$criteria = $this->criteriaFactory->createCriteria($stream->getId());

        $criteria->setFetchCount(false);
        $criteria->offset((int) $offset);

        if ($limit !== null) {
            $criteria->limit((int) $limit);
        }

        if ($criteria->getOffset() === 0) {
            $this->streamIndexer->clearStreamIndex($stream->getId());
        }

        $this->streamIndexer->populatePartial($stream->getId()$criteria);
    }

    /** * Returns true if frozen state has changed * * @param int $streamId * @param string|null $conditions * * @return array|null */
Home | Imprint | This part of the site doesn't use cookies.