6
6
7
7
namespace Magento \Catalog \Model \Indexer \Product \Price ;
8
8
9
+ use Magento \Catalog \Model \Product ;
9
10
use Magento \Catalog \Model \Product \Type ;
10
11
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \DefaultPrice ;
11
12
use Magento \Catalog \Model \ResourceModel \Product \Indexer \Price \Factory ;
20
21
use Magento \Framework \Exception \InputException ;
21
22
use Magento \Framework \Exception \LocalizedException ;
22
23
use Magento \Framework \Exception \NoSuchEntityException ;
24
+ use Magento \Framework \Indexer \CacheContext ;
23
25
use Magento \Framework \Indexer \DimensionalIndexerInterface ;
24
26
use Magento \Framework \Search \Request \Dimension ;
25
27
use Magento \Framework \Stdlib \DateTime ;
@@ -61,8 +63,6 @@ abstract class AbstractAction
61
63
protected $ _storeManager ;
62
64
63
65
/**
64
- * Currency factory
65
- *
66
66
* @var CurrencyFactory
67
67
*/
68
68
protected $ _currencyFactory ;
@@ -83,8 +83,6 @@ abstract class AbstractAction
83
83
protected $ _catalogProductType ;
84
84
85
85
/**
86
- * Indexer price factory
87
- *
88
86
* @var Factory
89
87
*/
90
88
protected $ _indexerPriceFactory ;
@@ -109,6 +107,11 @@ abstract class AbstractAction
109
107
*/
110
108
private $ tableMaintainer ;
111
109
110
+ /**
111
+ * @var CacheContext
112
+ */
113
+ private $ cacheContext ;
114
+
112
115
/**
113
116
* @param ScopeConfigInterface $config
114
117
* @param StoreManagerInterface $storeManager
@@ -121,6 +124,7 @@ abstract class AbstractAction
121
124
* @param TierPrice|null $tierPriceIndexResource
122
125
* @param DimensionCollectionFactory|null $dimensionCollectionFactory
123
126
* @param TableMaintainer|null $tableMaintainer
127
+ * @param CacheContext|null $cacheContext
124
128
* @SuppressWarnings(PHPMD.NPathComplexity)
125
129
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
126
130
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -136,7 +140,8 @@ public function __construct(
136
140
DefaultPrice $ defaultIndexerResource ,
137
141
TierPrice $ tierPriceIndexResource = null ,
138
142
DimensionCollectionFactory $ dimensionCollectionFactory = null ,
139
- TableMaintainer $ tableMaintainer = null
143
+ TableMaintainer $ tableMaintainer = null ,
144
+ CacheContext $ cacheContext = null
140
145
) {
141
146
$ this ->_config = $ config ;
142
147
$ this ->_storeManager = $ storeManager ;
@@ -156,6 +161,7 @@ public function __construct(
156
161
$ this ->tableMaintainer = $ tableMaintainer ?? ObjectManager::getInstance ()->get (
157
162
TableMaintainer::class
158
163
);
164
+ $ this ->cacheContext = $ cacheContext ?? ObjectManager::getInstance ()->get (CacheContext::class);
159
165
}
160
166
161
167
/**
@@ -391,6 +397,7 @@ protected function _reindexRows($changedIds = [])
391
397
392
398
if ($ changedIds ) {
393
399
$ this ->deleteIndexData ($ changedIds );
400
+ $ this ->cacheContext ->registerEntities (Product::CACHE_TAG , $ changedIds );
394
401
}
395
402
396
403
$ typeIndexers = $ this ->getTypeIndexers ();
0 commit comments