File tree Expand file tree Collapse file tree 5 files changed +7
-9
lines changed
Controller/Adminhtml/Product Expand file tree Collapse file tree 5 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 7
7
use Magento \Backend \Model \View \Result \Redirect ;
8
8
use Magento \Catalog \Api \ProductRepositoryInterface ;
9
9
use Magento \Backend \App \Action ;
10
+ use Magento \Catalog \Model \Product ;
10
11
use Magento \Catalog \Model \ResourceModel \Product \CollectionFactory ;
11
12
use Magento \Framework \App \Action \HttpPostActionInterface as HttpPostActionInterface ;
12
13
use Magento \Framework \Controller \ResultFactory ;
@@ -41,7 +42,7 @@ public function execute(): Redirect
41
42
42
43
$ productEnriched = 0 ;
43
44
if ($ this ->config ->isEnabled ()) {
44
- /** @var \Magento\Catalog\Model\ Product $product */
45
+ /** @var Product $product */
45
46
foreach ($ collection ->getItems () as $ product ) {
46
47
//@TODO: we hit rate limit, change to batching the request
47
48
$ this ->publisher ->execute ($ product ->getId (), $ this ->overwrite );
Original file line number Diff line number Diff line change 1
1
<?php
2
2
declare (strict_types=1 );
3
+
3
4
namespace MageOS \CatalogDataAI \Model ;
4
5
5
6
use Magento \Framework \App \Config \ScopeConfigInterface ;
6
- USE Magento \Catalog \Model \Product ;
7
+ use Magento \Catalog \Model \Product ;
7
8
8
9
class Config
9
10
{
@@ -19,8 +20,7 @@ class Config
19
20
20
21
public function __construct (
21
22
private readonly ScopeConfigInterface $ scopeConfig
22
- ) {
23
- }
23
+ ) {}
24
24
25
25
public function isEnabled (): bool
26
26
{
Original file line number Diff line number Diff line change 13
13
class Enricher
14
14
{
15
15
private Client $ client ;
16
- public function __construct
17
- (
16
+ public function __construct (
18
17
private readonly Factory $ clientFactory ,
19
18
private readonly Config $ config
20
19
) {
Original file line number Diff line number Diff line change @@ -16,8 +16,7 @@ class Publisher
16
16
public function __construct (
17
17
private readonly PublisherInterface $ publisher ,
18
18
private readonly RequestFactory $ requestFactory ,
19
- ) {
20
- }
19
+ ) {}
21
20
22
21
/**
23
22
* @param int|string $productId
Original file line number Diff line number Diff line change @@ -24,6 +24,5 @@ public function execute(Observer $observer): void
24
24
if ($ this ->config ->canEnrich ($ product ) && !$ this ->config ->isAsync ()) {
25
25
$ this ->enricher ->execute ($ product );
26
26
}
27
-
28
27
}
29
28
}
You can’t perform that action at this time.
0 commit comments