Skip to content

Commit 2d740d5

Browse files
author
Yaroslav Onischenko
committed
MAGETWO-52558: Cache is not invalidated or refreshed when product website visibility changes
1 parent 952ae3b commit 2d740d5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ public function execute(array $entityIds = [], $useTempTable = false)
4646
}
4747

4848
/**
49+
* Register affected products
50+
*
4951
* @param array $entityIds
52+
* @return void
5053
*/
5154
private function registerProducts($entityIds)
5255
{
@@ -65,10 +68,11 @@ private function registerCategories($entityIds)
6568
$this->connection->select()
6669
->from($this->getMainTable(), ['category_id'])
6770
->where('product_id IN (?)', $entityIds)
71+
->distinct()
6872
);
6973

7074
if ($categories) {
71-
$this->getCacheContext()->registerEntities(Category::CACHE_TAG, array_unique($categories));
75+
$this->getCacheContext()->registerEntities(Category::CACHE_TAG, $categories);
7276
}
7377
}
7478

@@ -137,7 +141,7 @@ protected function isRangingNeeded()
137141
* @return \Magento\Framework\Indexer\CacheContext
138142
* @deprecated
139143
*/
140-
protected function getCacheContext()
144+
private function getCacheContext()
141145
{
142146
if ($this->cacheContext === null) {
143147
$this->cacheContext = \Magento\Framework\App\ObjectManager::getInstance()->get(CacheContext::class);

app/code/Magento/Catalog/Plugin/Model/Product/Action/UpdateAttributesFlushCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function afterUpdateAttributes(
5050

5151
/**
5252
* @param Action $subject
53-
* @return Action
53+
* @return void
5454
*
5555
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5656
*/

0 commit comments

Comments
 (0)