@@ -24,6 +24,35 @@ class Converter extends \Magento\CatalogSampleData\Model\Product\Converter
24
24
*/
25
25
private $ filesystem ;
26
26
27
+ public function __construct (
28
+ \Magento \Catalog \Model \Category \TreeFactory $ categoryTreeFactory ,
29
+ \Magento \Catalog \Model \ResourceModel \Category \TreeFactory $ categoryResourceTreeFactory ,
30
+ \Magento \Eav \Model \Config $ eavConfig ,
31
+ \Magento \Catalog \Model \ResourceModel \Category \CollectionFactory $ categoryCollectionFactory ,
32
+ \Magento \Catalog \Model \ResourceModel \Product \Attribute \CollectionFactory $ attributeCollectionFactory ,
33
+ \Magento \Eav \Model \ResourceModel \Entity \Attribute \Option \CollectionFactory $ attrOptionCollectionFactory ,
34
+ \Magento \Catalog \Model \ResourceModel \Product \CollectionFactory $ productCollectionFactory ,
35
+ \Magento \Downloadable \Api \Data \File \ContentInterfaceFactory $ fileContentFactory = null ,
36
+ Filesystem $ filesystem = null
37
+ ) {
38
+ parent ::__construct (
39
+ $ categoryTreeFactory ,
40
+ $ categoryResourceTreeFactory ,
41
+ $ eavConfig ,
42
+ $ categoryCollectionFactory ,
43
+ $ attributeCollectionFactory ,
44
+ $ attrOptionCollectionFactory ,
45
+ $ productCollectionFactory
46
+ );
47
+ $ this ->fileContentFactory = $ fileContentFactory ?: ObjectManager::getInstance ()->get (
48
+ \Magento \Downloadable \Api \Data \File \ContentInterfaceFactory::class
49
+ );
50
+ $ this ->filesystem = $ filesystem ?: ObjectManager::getInstance ()->get (
51
+ Filesystem::class
52
+ );
53
+ }
54
+
55
+
27
56
/**
28
57
* Get downloadable data from array
29
58
*
@@ -159,11 +188,6 @@ public function getSamplesInfo()
159
188
*/
160
189
private function getFileContent ()
161
190
{
162
- if (!$ this ->fileContentFactory ) {
163
- $ this ->fileContentFactory = ObjectManager::getInstance ()->create (
164
- \Magento \Downloadable \Api \Data \File \ContentInterfaceFactory::class
165
- );
166
- }
167
191
return $ this ->fileContentFactory ->create ();
168
192
}
169
193
@@ -173,11 +197,6 @@ private function getFileContent()
173
197
*/
174
198
private function getFilesystem ()
175
199
{
176
- if (!$ this ->filesystem ) {
177
- $ this ->filesystem = ObjectManager::getInstance ()->create (
178
- Filesystem::class
179
- );
180
- }
181
200
return $ this ->filesystem ;
182
201
}
183
202
}
0 commit comments