7
7
8
8
namespace Magento \ConfigurableProduct \Model \Product ;
9
9
10
- use Magento \Catalog \Model \Product \Attribute \Source \Status ;
11
10
use Magento \Catalog \Model \Product \Type as ProductType ;
12
11
use Magento \Framework \Exception \LocalizedException ;
12
+ use Magento \Framework \ObjectManager \ResetAfterRequestInterface ;
13
13
14
14
/**
15
15
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
16
16
* @api
17
17
* @since 100.0.2
18
18
*/
19
- class VariationHandler
19
+ class VariationHandler implements ResetAfterRequestInterface
20
20
{
21
21
/**
22
22
* @var \Magento\Catalog\Model\Product\Gallery\Processor
@@ -52,7 +52,7 @@ class VariationHandler
52
52
/**
53
53
* @var \Magento\CatalogInventory\Api\StockConfigurationInterface
54
54
* @deprecated 100.1.0
55
- * @see MAGETWO-71174
55
+ * @see MSI
56
56
*/
57
57
protected $ stockConfiguration ;
58
58
@@ -121,7 +121,7 @@ public function generateSimpleProducts($parentProduct, $productsData)
121
121
* Prepare attribute set comprising all selected configurable attributes
122
122
*
123
123
* @deprecated 100.1.0
124
- * @see MAGETWO-71174
124
+ * @see prepareAttributeSet()
125
125
* @param \Magento\Catalog\Model\Product $product
126
126
* @return void
127
127
*/
@@ -205,6 +205,7 @@ protected function fillSimpleProductData(
205
205
$ parentProduct ->getData ($ attribute ->getAttributeCode ()) ?? $ attribute ->getDefaultValue ()
206
206
);
207
207
}
208
+
208
209
$ keysFilter = ['item_id ' , 'product_id ' , 'stock_id ' , 'type_id ' , 'website_id ' ];
209
210
$ postData ['stock_data ' ] = array_diff_key ((array )$ parentProduct ->getStockData (), array_flip ($ keysFilter ));
210
211
$ stockStatus = $ parentProduct ->getQuantityAndStockStatus ();
@@ -213,7 +214,9 @@ protected function fillSimpleProductData(
213
214
}
214
215
215
216
$ postData = $ this ->processMediaGallery ($ product , $ postData );
216
- $ postData ['status ' ] = $ postData ['status ' ] ?? Status::STATUS_ENABLED ;
217
+ $ postData ['status ' ] = isset ($ postData ['status ' ])
218
+ ? $ postData ['status ' ]
219
+ : \Magento \Catalog \Model \Product \Attribute \Source \Status::STATUS_ENABLED ;
217
220
$ product ->addData (
218
221
$ postData
219
222
)->setWebsiteIds (
@@ -300,4 +303,12 @@ function ($image) {
300
303
}
301
304
return $ productData ;
302
305
}
306
+
307
+ /**
308
+ * @inheritDoc
309
+ */
310
+ public function _resetState (): void
311
+ {
312
+ $ this ->attributes = [];
313
+ }
303
314
}
0 commit comments