@@ -52,8 +52,19 @@ class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementI
52
52
*/
53
53
private $ attributeFactory ;
54
54
55
+ /**
56
+ * @var ProductRepository|mixed
57
+ */
55
58
public \Magento \Catalog \Model \ProductRepository $ mediaGallery ;
59
+
60
+ /**
61
+ * @var ProductAttributeMediaGalleryEntryInterfaceFactory|mixed
62
+ */
56
63
public \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterfaceFactory $ myModelFactory ;
64
+
65
+ /**
66
+ * @var array
67
+ */
57
68
private array $ images ;
58
69
59
70
/**
@@ -73,17 +84,19 @@ public function __construct(
73
84
\Magento \ConfigurableProduct \Model \ResourceModel \Product \Type \Configurable $ configurableType ,
74
85
\Magento \Framework \Api \DataObjectHelper $ dataObjectHelper ,
75
86
\Magento \Catalog \Model \ResourceModel \Eav \AttributeFactory $ attributeFactory = null ,
76
- \Magento \Catalog \Model \ProductRepository $ mediaGalleryProcessor ,
77
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterfaceFactory $ myModelFactory
87
+ \Magento \Catalog \Model \ProductRepository $ mediaGalleryProcessor = null ,
88
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterfaceFactory $ myModelFactory = null
78
89
) {
79
90
$ this ->productRepository = $ productRepository ;
80
91
$ this ->productFactory = $ productFactory ;
81
92
$ this ->configurableType = $ configurableType ;
82
93
$ this ->dataObjectHelper = $ dataObjectHelper ;
83
94
$ this ->attributeFactory = $ attributeFactory ?: \Magento \Framework \App \ObjectManager::getInstance ()
84
95
->get (\Magento \Catalog \Model \ResourceModel \Eav \AttributeFactory::class);
85
- $ this ->mediaGallery = $ mediaGalleryProcessor ;
86
- $ this ->myModelFactory = $ myModelFactory ;
96
+ $ this ->mediaGallery = $ mediaGalleryProcessor ?: \Magento \Framework \App \ObjectManager::getInstance ()
97
+ ->get (\Magento \Catalog \Model \ProductRepository::class);
98
+ $ this ->myModelFactory = $ myModelFactory ?: \Magento \Framework \App \ObjectManager::getInstance ()
99
+ ->get (\Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterfaceFactory::class);;
87
100
}
88
101
89
102
/**
0 commit comments