11
11
use Magento \Catalog \Api \Data \ProductInterface ;
12
12
use Magento \Catalog \Api \ProductCustomOptionRepositoryInterface as OptionRepository ;
13
13
use Magento \Catalog \Model \Product \Option ;
14
+ use Magento \Catalog \Model \ResourceModel \Product \Relation ;
14
15
use Magento \Framework \App \ObjectManager ;
15
16
use Magento \Framework \EntityManager \Operation \ExtensionInterface ;
16
- use Magento \Catalog \Model \ResourceModel \Product \Relation ;
17
17
use Magento \Framework \Exception \CouldNotSaveException ;
18
18
19
19
/**
@@ -26,12 +26,12 @@ class SaveHandler implements ExtensionInterface
26
26
/**
27
27
* @var string[]
28
28
*/
29
- private $ compositeProductTypes = ['grouped ' , 'configurable ' , 'bundle ' ];
29
+ private array $ compositeProductTypes = ['grouped ' , 'configurable ' , 'bundle ' ];
30
30
31
31
/**
32
32
* @var OptionRepository
33
33
*/
34
- protected $ optionRepository ;
34
+ protected OptionRepository $ optionRepository ;
35
35
36
36
/**
37
37
* @var Relation
@@ -44,7 +44,7 @@ class SaveHandler implements ExtensionInterface
44
44
*/
45
45
public function __construct (
46
46
OptionRepository $ optionRepository ,
47
- ?Relation $ relation = null
47
+ ?Relation $ relation = null
48
48
) {
49
49
$ this ->optionRepository = $ optionRepository ;
50
50
$ this ->relation = $ relation ?: ObjectManager::getInstance ()->get (Relation::class);
@@ -57,6 +57,7 @@ public function __construct(
57
57
* @param array $arguments
58
58
* @return ProductInterface|object
59
59
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
60
+ * @throws CouldNotSaveException
60
61
*/
61
62
public function execute ($ entity , $ arguments = [])
62
63
{
@@ -88,7 +89,7 @@ public function execute($entity, $arguments = [])
88
89
89
90
/**
90
91
* Save custom options
91
- *
92
+ *
92
93
* @param array $options
93
94
* @param bool $hasChangedSku
94
95
* @param ProductInterface $product
@@ -127,7 +128,6 @@ private function isProductHasRelations(ProductInterface $product): bool
127
128
) {
128
129
$ result = false ;
129
130
}
130
-
131
131
return $ result ;
132
132
}
133
133
}
0 commit comments