Skip to content

Commit

Permalink
SUPESC-766: Optimized product list query (#11275)
Browse files Browse the repository at this point in the history
SUPESC-766 Optimized product list query.
  • Loading branch information
vol4onok authored Jan 15, 2025
1 parent cce0227 commit ccc1b3a
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/Spryker/Zed/ProductList/Persistence/ProductListRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ public function getProductListByProductAbstractIdsThroughCategory(array $product
->withColumn(SpyProductListTableMap::COL_TYPE, static::COL_TYPE)
->withColumn(SpyProductListCategoryTableMap::COL_FK_PRODUCT_LIST, static::COL_ID_PRODUCT_LIST)
->withColumn(SpyProductCategoryTableMap::COL_FK_PRODUCT_ABSTRACT, static::COL_ID_PRODUCT_ABSTRACT)
->distinct()
->innerJoinWithSpyCategory()
->useSpyCategoryQuery()
->innerJoinWithSpyProductCategory()
Expand All @@ -455,11 +456,6 @@ public function getProductListByProductAbstractIdsThroughCategory(array $product
->endUse()
->endUse()
->innerJoinWithSpyProductList()
->groupBy([
SpyProductCategoryTableMap::COL_FK_PRODUCT_ABSTRACT,
SpyProductListCategoryTableMap::COL_FK_PRODUCT_LIST,
SpyProductListTableMap::COL_TYPE,
])
->find()
->toArray();
}
Expand Down Expand Up @@ -493,7 +489,6 @@ public function getProductBlacklistsByProductAbstractIds(array $productAbstractI
->groupBy([
SpyProductListProductConcreteTableMap::COL_FK_PRODUCT_LIST,
SpyProductTableMap::COL_FK_PRODUCT_ABSTRACT,
SpyProductListTableMap::COL_TYPE,
])
->having(sprintf(
'COUNT(DISTINCT %s) = COUNT(DISTINCT %s)',
Expand All @@ -520,17 +515,13 @@ public function getProductWhiteListsByProductAbstractIds(array $productAbstractI
->select([
SpyProductListProductConcreteTableMap::COL_FK_PRODUCT_LIST,
])
->distinct()
->useSpyProductQuery()
->filterByFkProductAbstract_In($productAbstractIds)
->endUse()
->useSpyProductListQuery(null, Criteria::INNER_JOIN)
->filterByType(SpyProductListTableMap::COL_TYPE_WHITELIST)
->endUse()
->groupBy([
SpyProductListProductConcreteTableMap::COL_FK_PRODUCT_LIST,
SpyProductTableMap::COL_FK_PRODUCT_ABSTRACT,
SpyProductListTableMap::COL_TYPE,
])
->setFormatter(SimpleArrayFormatter::class)
->find()
->toArray();
Expand Down

0 comments on commit ccc1b3a

Please sign in to comment.