Skip to content

Commit d8a386e

Browse files
committed
Replace load in the loop with proper data provider
1 parent d3adb7a commit d8a386e

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -657,23 +657,11 @@ public function validateByEntityId($productId)
657657
* Retrieve category ids where product is available
658658
*
659659
* @param int $productId
660-
* @return array
660+
* @return int[]
661661
*/
662662
protected function _getAvailableInCategories($productId)
663663
{
664-
return $this->_productResource->getConnection()
665-
->fetchCol(
666-
$this->_productResource->getConnection()
667-
->select()
668-
->distinct()
669-
->from(
670-
$this->_productResource->getTable('catalog_category_product'),
671-
['category_id']
672-
)->where(
673-
'product_id = ?',
674-
$productId
675-
)
676-
);
664+
return $this->productCategoryList->getCategoryIds($productId);
677665
}
678666

679667
/**

0 commit comments

Comments
 (0)