Skip to content

Commit 4b64cfe

Browse files
committed
Merge branch 'slices' into develop
2 parents 54989c3 + 259e012 commit 4b64cfe

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

main/src/Model/Bridge/ProductRepository.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,23 @@ public function getProductsInChunks($storeId, ProductIdChunks $chunks)
6666
}
6767

6868
/**
69+
* @param null|int $sliceId
70+
* @param null|int $totalNumberSlices
6971
* @return int[]
7072
*/
71-
public function getAllProductIds()
73+
public function getAllProductIds($sliceId = null, $totalNumberSlices = null)
7274
{
73-
return $this->productCollectionFactory->create()->getAllIds();
75+
/** @var ProductCollection $productCollection */
76+
$productCollection = $this->productCollectionFactory->create();
77+
78+
if ((!is_null($sliceId)) && (!is_null($totalNumberSlices))) {
79+
if ($sliceId == $totalNumberSlices) {
80+
$sliceId = 0;
81+
}
82+
$productCollection->getSelect()->where('e.entity_id % ' . intval($totalNumberSlices) . ' = ' . intval($sliceId));
83+
}
84+
85+
return $productCollection->getAllIds();
7486
}
7587

7688
/**

0 commit comments

Comments
 (0)