@@ -13,27 +13,19 @@ class ProductObserver
13
13
/** @var Product */
14
14
private $ indexer ;
15
15
16
- /** @var ConfigHelper */
17
- private $ configHelper ;
18
-
19
- /**
20
- * @param IndexerRegistry $indexerRegistry
21
- * @param ConfigHelper $configHelper
22
- */
23
- public function __construct (IndexerRegistry $ indexerRegistry , ConfigHelper $ configHelper )
16
+ public function __construct (IndexerRegistry $ indexerRegistry )
24
17
{
25
18
$ this ->indexer = $ indexerRegistry ->get ('algolia_products ' );
26
- $ this ->configHelper = $ configHelper ;
27
19
}
28
20
29
21
/**
30
22
* @param ProductResource $productResource
31
23
* @param ProductResource $result
32
24
* @param ProductModel $product
33
25
*
34
- * @return ProductModel[]
26
+ * @return ProductResource
35
27
*/
36
- public function afterSave (ProductResource $ productResource , ProductResource $ result , ProductModel $ product )
28
+ public function afterSave (ProductResource $ productResource , ProductResource $ result , ProductModel $ product ): ProductResource
37
29
{
38
30
$ productResource ->addCommitCallback (function () use ($ product ) {
39
31
if (!$ this ->indexer ->isScheduled ()) {
@@ -49,9 +41,9 @@ public function afterSave(ProductResource $productResource, ProductResource $res
49
41
* @param ProductResource $result
50
42
* @param ProductModel $product
51
43
*
52
- * @return ProductModel[]
44
+ * @return ProductResource
53
45
*/
54
- public function afterDelete (ProductResource $ productResource , ProductResource $ result , ProductModel $ product )
46
+ public function afterDelete (ProductResource $ productResource , ProductResource $ result , ProductModel $ product ): ProductResource
55
47
{
56
48
$ productResource ->addCommitCallback (function () use ($ product ) {
57
49
if (!$ this ->indexer ->isScheduled ()) {
@@ -69,7 +61,7 @@ public function afterDelete(ProductResource $productResource, ProductResource $r
69
61
*
70
62
* @return Action
71
63
*/
72
- public function afterUpdateAttributes (Action $ subject , Action $ result , $ productIds )
64
+ public function afterUpdateAttributes (Action $ subject , Action $ result , array $ productIds ): Action
73
65
{
74
66
if (!$ this ->indexer ->isScheduled ()) {
75
67
$ this ->indexer ->reindexList (array_unique ($ productIds ));
@@ -80,17 +72,15 @@ public function afterUpdateAttributes(Action $subject, Action $result, $productI
80
72
81
73
/**
82
74
* @param Action $subject
83
- * @param Action $result
75
+ * @param null $result
84
76
* @param array $productIds
85
77
*
86
- * @return mixed
78
+ * @return void
87
79
*/
88
- public function afterUpdateWebsites (Action $ subject , Action $ result , array $ productIds )
80
+ public function afterUpdateWebsites (Action $ subject , null $ result , array $ productIds ): void
89
81
{
90
82
if (!$ this ->indexer ->isScheduled ()) {
91
83
$ this ->indexer ->reindexList (array_unique ($ productIds ));
92
84
}
93
-
94
- return $ result ;
95
85
}
96
86
}
0 commit comments