5
5
*/
6
6
namespace Magento \ConfigurableSampleData \Model ;
7
7
8
- use Magento \Framework \App \ObjectManager ;
9
8
use Magento \Framework \Component \ComponentRegistrar ;
10
9
use Magento \Framework \Filesystem \Directory \ReadFactory ;
11
10
use Magento \ImportExport \Model \Import ;
16
15
*/
17
16
class Product
18
17
{
18
+ /**
19
+ * @var Import
20
+ */
21
+ private $ importModel ;
22
+
19
23
/**
20
24
* @var \Magento\ImportExport\Model\Import\Source\CsvFactory
21
25
*/
@@ -36,11 +40,6 @@ class Product
36
40
*/
37
41
private $ componentRegistrar ;
38
42
39
- /**
40
- * @var \Magento\ImportExport\Model\ImportFactory
41
- */
42
- private $ importFactory ;
43
-
44
43
/**
45
44
* @var \Magento\Eav\Model\Config
46
45
*/
@@ -53,37 +52,31 @@ class Product
53
52
* @param \Magento\Indexer\Model\Indexer\CollectionFactory $indexerCollectionFactory
54
53
* @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory
55
54
* @param \Magento\Framework\Component\ComponentRegistrar $componentRegistrar
56
- * @param \Magento\ImportExport\Model\ImportFactory|null $importFactory
57
55
*/
58
56
public function __construct (
59
57
\Magento \Eav \Model \Config $ eavConfig ,
60
58
Import $ importModel ,
61
59
\Magento \ImportExport \Model \Import \Source \CsvFactory $ csvSourceFactory ,
62
60
\Magento \Indexer \Model \Indexer \CollectionFactory $ indexerCollectionFactory ,
63
61
\Magento \Framework \Filesystem \Directory \ReadFactory $ readFactory ,
64
- \Magento \Framework \Component \ComponentRegistrar $ componentRegistrar ,
65
- ?\Magento \ImportExport \Model \ImportFactory $ importFactory = null
62
+ \Magento \Framework \Component \ComponentRegistrar $ componentRegistrar
66
63
) {
67
64
$ this ->eavConfig = $ eavConfig ;
65
+ $ this ->importModel = $ importModel ;
68
66
$ this ->csvSourceFactory = $ csvSourceFactory ;
69
67
$ this ->indexerCollectionFactory = $ indexerCollectionFactory ;
70
68
$ this ->readFactory = $ readFactory ;
71
69
$ this ->componentRegistrar = $ componentRegistrar ;
72
- $ this ->importFactory = $ importFactory
73
- ?? ObjectManager::getInstance ()->get (\Magento \ImportExport \Model \ImportFactory::class);
74
70
}
75
71
76
72
/**
77
73
* @inheritdoc
78
74
*/
79
75
public function install ()
80
76
{
81
- \Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType::$ attributeCodeToId = [];
82
- \Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType::$ commonAttributesCache = [];
83
- \Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType::$ invAttributesCache = [];
84
77
$ this ->eavConfig ->clear ();
85
78
/** @var Import $importModel */
86
- $ importModel = $ this ->importFactory -> create () ;
79
+ $ importModel = $ this ->importModel ;
87
80
$ importModel ->setData (
88
81
[
89
82
'entity ' => 'catalog_product ' ,
0 commit comments