Skip to content

Commit 91b8062

Browse files
author
Oleksandr Gorkun
committed
MAGETWO-71576: [Backport] - Cache invalidation after saving catalog - RIATCS-340 - for 2.1
1 parent 3f0648e commit 91b8062

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

app/code/Magento/Catalog/Model/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ public function getIdentities()
11291129
{
11301130
$identities = [];
11311131
if ($this->getId()) {
1132-
$identities[] = self::CACHE_TAG.'_'.$this->getId();
1132+
$identities[] = self::CACHE_TAG . '_' . $this->getId();
11331133
}
11341134
if ($this->getId()
11351135
&& (

app/code/Magento/Catalog/Model/Product.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,9 @@ protected function _afterLoad()
10591059
public function cleanCache()
10601060
{
10611061
if ($this->getId()) {
1062-
$this->_cacheManager->clean(self::CACHE_TAG.'_'.$this->getId());
1062+
$this->_cacheManager->clean(
1063+
self::CACHE_TAG . '_' . $this->getId()
1064+
);
10631065
}
10641066
return $this;
10651067
}
@@ -2283,7 +2285,7 @@ public function getIdentities()
22832285
$identities = [];
22842286

22852287
if ($this->getId()) {
2286-
$identities[] = self::CACHE_TAG.'_'.$this->getId();
2288+
$identities[] = self::CACHE_TAG . '_' . $this->getId();
22872289
}
22882290
if ($this->getIsChangedCategories()) {
22892291
foreach ($this->getAffectedCategoryIds() as $categoryId) {

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ private function generateConfigurableAttributesCacheId(
466466
);
467467
}
468468

469-
return __CLASS__.$productId.'_'.$product->getStoreId();
469+
return __CLASS__ . $productId . '_' . $product->getStoreId();
470470
}
471471

472472
/**
@@ -551,7 +551,7 @@ private function cacheConfigurableAttributes(
551551
$this->generateConfigurableAttributesCacheId($product),
552552
array_merge(
553553
$product->getIdentities(),
554-
[self::TYPE_CODE.'_'.$productId]
554+
[self::TYPE_CODE . '_' . $productId]
555555
)
556556
);
557557
} else {
@@ -570,7 +570,7 @@ private function cacheConfigurableAttributes(
570570
public function getConfigurableAttributes($product)
571571
{
572572
\Magento\Framework\Profiler::start(
573-
'CONFIGURABLE:'.__METHOD__,
573+
'CONFIGURABLE:' . __METHOD__,
574574
['group' => 'CONFIGURABLE', 'method' => __METHOD__]
575575
);
576576
if (!$product->hasData($this->_configurableAttributes)) {
@@ -596,7 +596,7 @@ public function getConfigurableAttributes($product)
596596
$configurableAttributes
597597
);
598598
}
599-
\Magento\Framework\Profiler::stop('CONFIGURABLE:'.__METHOD__);
599+
\Magento\Framework\Profiler::stop('CONFIGURABLE:' . __METHOD__);
600600

601601
return $product->getData($this->_configurableAttributes);
602602
}
@@ -843,7 +843,7 @@ public function beforeSave($product)
843843
$this->getCache()
844844
->clean(
845845
\Zend_Cache::CLEANING_MODE_MATCHING_TAG,
846-
[self::TYPE_CODE.'_'.$productId]
846+
[self::TYPE_CODE . '_' . $productId]
847847
);
848848
}
849849
parent::beforeSave($product);

app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ public function testGetConfigurableAttributes()
602602
->method('save')
603603
->with(
604604
serialize($attributeCollection),
605-
get_class($this->_model).'1_0'
605+
get_class($this->_model) . '1_0'
606606
);
607607

608608
$this->assertEquals($expectedData, $this->_model->getConfigurableAttributes($product));

0 commit comments

Comments
 (0)