Skip to content

Commit 0e68e70

Browse files
committed
reindexById and reindexByIds should be functionally equal
1 parent 5972daa commit 0e68e70

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,19 +255,11 @@ public function __construct(
255255
public function reindexById($id)
256256
{
257257
try {
258-
$this->cleanProductIndex([$id]);
259-
260-
$products = $this->productLoader->getProducts([$id]);
261-
$activeRules = $this->getActiveRules();
262-
foreach ($products as $product) {
263-
$this->applyRules($activeRules, $product);
264-
}
265-
266-
$this->reindexRuleGroupWebsite->execute();
258+
$this->doReindexByIds([$id]);
267259
} catch (\Exception $e) {
268260
$this->critical($e);
269261
throw new \Magento\Framework\Exception\LocalizedException(
270-
__('Catalog rule indexing failed. See details in exception log.')
262+
__("Catalog rule indexing failed. See details in exception log.")
271263
);
272264
}
273265
}
@@ -404,6 +396,8 @@ protected function cleanByIds($productIds)
404396
*
405397
* @return void
406398
* @throws \Exception
399+
* @deprecated
400+
* @see ReindexRuleProduct::execute
407401
*/
408402
private function assignProductToRule(Rule $rule, int $productEntityId, array $websiteIds): void
409403
{
@@ -488,6 +482,8 @@ protected function applyRule(Rule $rule, $product)
488482
*
489483
* @param RuleCollection $ruleCollection
490484
* @param Product $product
485+
* @deprecated
486+
* @see ReindexRuleProduct::execute
491487
* @return void
492488
*/
493489
private function applyRules(RuleCollection $ruleCollection, Product $product): void

0 commit comments

Comments
 (0)