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,
]);
}