6
6
7
7
namespace Magento \Customer \Setup ;
8
8
9
- use Magento \Framework \Module \Setup \Migration ;
9
+ use Magento \Customer \Model \Customer ;
10
+ use Magento \Framework \Indexer \IndexerRegistry ;
10
11
use Magento \Framework \Setup \UpgradeDataInterface ;
11
12
use Magento \Framework \Setup \ModuleContextInterface ;
12
13
use Magento \Framework \Setup \ModuleDataSetupInterface ;
@@ -21,16 +22,31 @@ class UpgradeData implements UpgradeDataInterface
21
22
*
22
23
* @var CustomerSetupFactory
23
24
*/
24
- private $ customerSetupFactory ;
25
+ protected $ customerSetupFactory ;
26
+
27
+ /**
28
+ * @var IndexerRegistry
29
+ */
30
+ protected $ indexerRegistry ;
31
+
32
+ /**
33
+ * @var \Magento\Eav\Model\Config
34
+ */
35
+ protected $ eavConfig ;
25
36
26
37
/**
27
- * Init
28
- *
29
38
* @param CustomerSetupFactory $customerSetupFactory
39
+ * @param IndexerRegistry $indexerRegistry
40
+ * @param \Magento\Eav\Model\Config $eavConfig
30
41
*/
31
- public function __construct (CustomerSetupFactory $ customerSetupFactory )
32
- {
42
+ public function __construct (
43
+ CustomerSetupFactory $ customerSetupFactory ,
44
+ IndexerRegistry $ indexerRegistry ,
45
+ \Magento \Eav \Model \Config $ eavConfig
46
+ ) {
33
47
$ this ->customerSetupFactory = $ customerSetupFactory ;
48
+ $ this ->indexerRegistry = $ indexerRegistry ;
49
+ $ this ->eavConfig = $ eavConfig ;
34
50
}
35
51
36
52
/**
@@ -171,6 +187,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
171
187
}
172
188
}
173
189
190
+ $ indexer = $ this ->indexerRegistry ->get (Customer::CUSTOMER_GRID_INDEXER_ID );
191
+ $ indexer ->reindexAll ();
192
+ $ this ->eavConfig ->clear ();
193
+
174
194
$ setup ->endSetup ();
175
195
}
176
196
}
0 commit comments