5
5
*/
6
6
namespace Magento \Catalog \Model \Indexer \Product ;
7
7
8
+ use Magento \Catalog \Model \Category as CategoryModel ;
9
+ use Magento \Catalog \Model \Indexer \Product \Price \Action \Full as FullAction ;
10
+ use Magento \Catalog \Model \Indexer \Product \Price \Action \Row as RowAction ;
11
+ use Magento \Catalog \Model \Indexer \Product \Price \Action \Rows as RowsAction ;
12
+ use Magento \Catalog \Model \Product as ProductModel ;
13
+ use Magento \Framework \Indexer \ActionInterface as IndexerActionInterface ;
8
14
use Magento \Framework \Indexer \CacheContext ;
15
+ use Magento \Framework \Mview \ActionInterface as MviewActionInterface ;
9
16
10
- class Price implements \Magento \Framework \Indexer \ActionInterface, \Magento \Framework \Mview \ActionInterface
17
+ /**
18
+ * Price indexer
19
+ */
20
+ class Price implements IndexerActionInterface, MviewActionInterface
11
21
{
12
22
/**
13
- * @var \Magento\Catalog\Model\Indexer\Product\Price\Action\Row
23
+ * @var RowAction
14
24
*/
15
25
protected $ _productPriceIndexerRow ;
16
26
17
27
/**
18
- * @var \Magento\Catalog\Model\Indexer\Product\Price\Action\Rows
28
+ * @var RowsAction
19
29
*/
20
30
protected $ _productPriceIndexerRows ;
21
31
22
32
/**
23
- * @var \Magento\Catalog\Model\Indexer\Product\Price\Action\Full
33
+ * @var FullAction
24
34
*/
25
35
protected $ _productPriceIndexerFull ;
26
36
27
37
/**
28
- * @var \Magento\Framework\Indexer\ CacheContext
38
+ * @var CacheContext
29
39
*/
30
40
private $ cacheContext ;
31
41
32
42
/**
33
- * @param Price\Action\Row $productPriceIndexerRow
34
- * @param Price\Action\Rows $productPriceIndexerRows
35
- * @param Price\Action\Full $productPriceIndexerFull
43
+ * @param RowAction $productPriceIndexerRow
44
+ * @param RowsAction $productPriceIndexerRows
45
+ * @param FullAction $productPriceIndexerFull
46
+ * @param CacheContext $cacheContext
36
47
*/
37
48
public function __construct (
38
- \Magento \Catalog \Model \Indexer \Product \Price \Action \Row $ productPriceIndexerRow ,
39
- \Magento \Catalog \Model \Indexer \Product \Price \Action \Rows $ productPriceIndexerRows ,
40
- \Magento \Catalog \Model \Indexer \Product \Price \Action \Full $ productPriceIndexerFull
49
+ RowAction $ productPriceIndexerRow ,
50
+ RowsAction $ productPriceIndexerRows ,
51
+ FullAction $ productPriceIndexerFull ,
52
+ CacheContext $ cacheContext
41
53
) {
42
54
$ this ->_productPriceIndexerRow = $ productPriceIndexerRow ;
43
55
$ this ->_productPriceIndexerRows = $ productPriceIndexerRows ;
44
56
$ this ->_productPriceIndexerFull = $ productPriceIndexerFull ;
57
+ $ this ->cacheContext = $ cacheContext ;
45
58
}
46
59
47
60
/**
@@ -53,7 +66,7 @@ public function __construct(
53
66
public function execute ($ ids )
54
67
{
55
68
$ this ->_productPriceIndexerRows ->execute ($ ids );
56
- $ this ->getCacheContext () ->registerEntities (\ Magento \ Catalog \ Model \Product ::CACHE_TAG , $ ids );
69
+ $ this ->cacheContext ->registerEntities (ProductModel ::CACHE_TAG , $ ids );
57
70
}
58
71
59
72
/**
@@ -64,10 +77,10 @@ public function execute($ids)
64
77
public function executeFull ()
65
78
{
66
79
$ this ->_productPriceIndexerFull ->execute ();
67
- $ this ->getCacheContext () ->registerTags (
80
+ $ this ->cacheContext ->registerTags (
68
81
[
69
- \ Magento \ Catalog \ Model \Category ::CACHE_TAG ,
70
- \ Magento \ Catalog \ Model \Product ::CACHE_TAG
82
+ CategoryModel ::CACHE_TAG ,
83
+ ProductModel ::CACHE_TAG
71
84
]
72
85
);
73
86
}
@@ -81,6 +94,7 @@ public function executeFull()
81
94
public function executeList (array $ ids )
82
95
{
83
96
$ this ->_productPriceIndexerRows ->execute ($ ids );
97
+ $ this ->cacheContext ->registerEntities (ProductModel::CACHE_TAG , $ ids );
84
98
}
85
99
86
100
/**
@@ -92,20 +106,6 @@ public function executeList(array $ids)
92
106
public function executeRow ($ id )
93
107
{
94
108
$ this ->_productPriceIndexerRow ->execute ($ id );
95
- }
96
-
97
- /**
98
- * Get cache context
99
- *
100
- * @return \Magento\Framework\Indexer\CacheContext
101
- * @deprecated 100.0.11
102
- */
103
- protected function getCacheContext ()
104
- {
105
- if (!($ this ->cacheContext instanceof CacheContext)) {
106
- return \Magento \Framework \App \ObjectManager::getInstance ()->get (CacheContext::class);
107
- } else {
108
- return $ this ->cacheContext ;
109
- }
109
+ $ this ->cacheContext ->registerEntities (ProductModel::CACHE_TAG , [$ id ]);
110
110
}
111
111
}
0 commit comments