9
9
use Algolia \AlgoliaSearch \Exception \UnknownSkuException ;
10
10
use Algolia \AlgoliaSearch \Helper \Data as DataHelper ;
11
11
use Algolia \AlgoliaSearch \Helper \Entity \ProductHelper ;
12
+ use Algolia \AlgoliaSearch \Service \Product \IndexBuilder as ProductIndexBuilder ;
12
13
use Magento \Backend \App \Action \Context ;
13
14
use Magento \Catalog \Api \ProductRepositoryInterface ;
14
15
use Magento \Framework \Controller \ResultFactory ;
@@ -19,37 +20,15 @@ class Save extends \Magento\Backend\App\Action
19
20
{
20
21
public const MAX_SKUS = 10 ;
21
22
22
- /** @var ProductRepositoryInterface */
23
- protected $ productRepository ;
24
-
25
- /** @var StoreManagerInterface */
26
- protected $ storeManager ;
27
-
28
- /** @var DataHelper */
29
- protected $ dataHelper ;
30
-
31
- /** @var ProductHelper */
32
- protected $ productHelper ;
33
-
34
- /**
35
- * @param Context $context
36
- * @param ProductRepositoryInterface $productRepository
37
- * @param StoreManagerInterface $storeManager
38
- * @param DataHelper $dataHelper
39
- * @param ProductHelper $productHelper
40
- */
41
23
public function __construct (
42
- Context $ context ,
43
- ProductRepositoryInterface $ productRepository ,
44
- StoreManagerInterface $ storeManager ,
45
- DataHelper $ dataHelper ,
46
- ProductHelper $ productHelper
24
+ protected Context $ context ,
25
+ protected ProductRepositoryInterface $ productRepository ,
26
+ protected StoreManagerInterface $ storeManager ,
27
+ protected DataHelper $ dataHelper ,
28
+ protected ProductHelper $ productHelper ,
29
+ protected ProductIndexBuilder $ productIndexBuilder
47
30
) {
48
31
parent ::__construct ($ context );
49
- $ this ->storeManager = $ storeManager ;
50
- $ this ->dataHelper = $ dataHelper ;
51
- $ this ->productHelper = $ productHelper ;
52
- $ this ->productRepository = $ productRepository ;
53
32
}
54
33
55
34
/**
@@ -220,7 +199,7 @@ protected function checkAndReindex($product, $stores)
220
199
$ productIds = [$ product ->getId ()];
221
200
$ productIds = array_merge ($ productIds , $ this ->productHelper ->getParentProductIds ($ productIds ));
222
201
223
- $ this ->dataHelper -> rebuildStoreProductIndex ($ storeId , $ productIds );
202
+ $ this ->productIndexBuilder -> rebuildEntityIds ($ storeId , $ productIds );
224
203
$ this ->messageManager ->addSuccessMessage (
225
204
__ (
226
205
'The Product "%1" (%2) has been reindexed for store "%3 / %4 / %5". ' ,
0 commit comments