6
6
namespace Magento \CatalogInventory \Setup ;
7
7
8
8
use Magento \CatalogInventory \Api \StockConfigurationInterface ;
9
+ use Magento \Framework \Indexer \AbstractProcessor ;
9
10
use Magento \Framework \Setup \UpgradeDataInterface ;
10
11
use Magento \Framework \Setup \ModuleContextInterface ;
11
12
use Magento \Framework \Setup \ModuleDataSetupInterface ;
@@ -22,6 +23,11 @@ class UpgradeData implements UpgradeDataInterface
22
23
*/
23
24
private $ configuration ;
24
25
26
+ /**
27
+ * @var AbstractProcessor
28
+ */
29
+ private $ indexerProcessor ;
30
+
25
31
/**
26
32
* @var StoreManagerInterface
27
33
*/
@@ -30,13 +36,16 @@ class UpgradeData implements UpgradeDataInterface
30
36
/**
31
37
* @param StockConfigurationInterface $configuration
32
38
* @param StoreManagerInterface $storeManager
39
+ * @param AbstractProcessor $indexerProcessor
33
40
*/
34
41
public function __construct (
35
42
StockConfigurationInterface $ configuration ,
36
- StoreManagerInterface $ storeManager
43
+ StoreManagerInterface $ storeManager ,
44
+ AbstractProcessor $ indexerProcessor
37
45
) {
38
46
$ this ->configuration = $ configuration ;
39
47
$ this ->storeManager = $ storeManager ;
48
+ $ this ->indexerProcessor = $ indexerProcessor ;
40
49
}
41
50
42
51
/**
@@ -63,5 +72,6 @@ private function upgradeCatalogInventoryStockItem($setup)
63
72
['website_id ' => $ this ->configuration ->getDefaultScopeId ()],
64
73
['website_id = ? ' => $ this ->storeManager ->getWebsite ()->getId ()]
65
74
);
75
+ $ this ->indexerProcessor ->getIndexer ()->invalidate ();
66
76
}
67
77
}
0 commit comments