@@ -69,6 +69,7 @@ class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementI
69
69
* @param \Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory $attributeFactory
70
70
* @param \Magento\Catalog\Model\ProductRepository $mediaGalleryProcessor
71
71
* @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory $myModelFactory
72
+ * @param \Magento\ConfigurableProduct\Helper\Product\Options\Factory $optionsFactory
72
73
*/
73
74
public function __construct (
74
75
\Magento \Catalog \Api \ProductRepositoryInterface $ productRepository ,
@@ -77,7 +78,8 @@ public function __construct(
77
78
\Magento \Framework \Api \DataObjectHelper $ dataObjectHelper ,
78
79
\Magento \Catalog \Model \ResourceModel \Eav \AttributeFactory $ attributeFactory = null ,
79
80
\Magento \Catalog \Model \ProductRepository $ mediaGalleryProcessor = null ,
80
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterfaceFactory $ myModelFactory = null
81
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterfaceFactory $ myModelFactory = null ,
82
+ \Magento \ConfigurableProduct \Helper \Product \Options \Factory $ optionsFactory = null
81
83
) {
82
84
$ this ->productRepository = $ productRepository ;
83
85
$ this ->productFactory = $ productFactory ;
@@ -89,6 +91,8 @@ public function __construct(
89
91
->get (\Magento \Catalog \Model \ProductRepository::class);
90
92
$ this ->myModelFactory = $ myModelFactory ?: \Magento \Framework \App \ObjectManager::getInstance ()
91
93
->get (\Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterfaceFactory::class);
94
+ $ this ->optionsFactory = $ optionsFactory ?: \Magento \Framework \App \ObjectManager::getInstance ()
95
+ ->get (\Magento \ConfigurableProduct \Helper \Product \Options \Factory::class);
92
96
}
93
97
94
98
/**
@@ -192,7 +196,7 @@ public function addChild($sku, $childSku)
192
196
$ configurableOptionData = $ this ->getConfigurableAttributesData ($ attributeData );
193
197
194
198
/** @var \Magento\ConfigurableProduct\Helper\Product\Options\Factory $optionFactory */
195
- $ optionFactory = $ this ->getOptionsFactory ();
199
+ $ optionFactory = $ this ->optionsFactory ();
196
200
$ options = $ optionFactory ->create ($ configurableOptionData );
197
201
$ childrenIds [] = $ child ->getId ();
198
202
$ product ->getExtensionAttributes ()->setConfigurableProductOptions ($ options );
@@ -236,23 +240,6 @@ public function removeChild($sku, $childSku)
236
240
return true ;
237
241
}
238
242
239
- /**
240
- * Get Options Factory
241
- *
242
- * @return \Magento\ConfigurableProduct\Helper\Product\Options\Factory
243
- *
244
- * @deprecated 100.2.0
245
- * @see Nothing
246
- */
247
- private function getOptionsFactory ()
248
- {
249
- if (!$ this ->optionsFactory ) {
250
- $ this ->optionsFactory = \Magento \Framework \App \ObjectManager::getInstance ()
251
- ->get (\Magento \ConfigurableProduct \Helper \Product \Options \Factory::class);// phpcs:ignore
252
- }
253
- return $ this ->optionsFactory ;
254
- }
255
-
256
243
/**
257
244
* Get Configurable Attribute Data
258
245
*
0 commit comments