5
5
*/
6
6
namespace Magento \BundleSampleData \Model ;
7
7
8
+ use Magento \Framework \Setup \SampleData \Context as SampleDataContext ;
8
9
use Magento \Bundle \Api \Data \OptionInterfaceFactory as OptionFactory ;
9
10
use Magento \Bundle \Api \Data \LinkInterfaceFactory as LinkFactory ;
10
11
use Magento \Catalog \Api \ProductRepositoryInterface as ProductRepository ;
@@ -25,6 +26,37 @@ class Product extends \Magento\CatalogSampleData\Model\Product
25
26
*/
26
27
private $ optionFactory ;
27
28
29
+ /**
30
+ * Product constructor.
31
+ * @param SampleDataContext $sampleDataContext
32
+ * @param \Magento\Catalog\Model\ProductFactory $productFactory
33
+ * @param \Magento\Catalog\Model\ConfigFactory $catalogConfig
34
+ * @param Product\Converter $converter
35
+ * @param \Magento\CatalogSampleData\Model\Product\Gallery $gallery
36
+ * @param \Magento\Store\Model\StoreManagerInterface $storeManager
37
+ * @param \Magento\Eav\Model\Config $eavConfig
38
+ */
39
+ public function __construct (
40
+ SampleDataContext $ sampleDataContext ,
41
+ \Magento \Catalog \Model \ProductFactory $ productFactory ,
42
+ \Magento \Catalog \Model \ConfigFactory $ catalogConfig ,
43
+ \Magento \BundleSampleData \Model \Product \Converter $ converter ,
44
+ \Magento \CatalogSampleData \Model \Product \Gallery $ gallery ,
45
+ \Magento \Store \Model \StoreManagerInterface $ storeManager ,
46
+ \Magento \Eav \Model \Config $ eavConfig
47
+ ) {
48
+ $ this ->eavConfig = $ eavConfig ;
49
+ parent ::__construct (
50
+ $ sampleDataContext ,
51
+ $ productFactory ,
52
+ $ catalogConfig ,
53
+ $ converter ,
54
+ $ gallery ,
55
+ $ storeManager ,
56
+ $ eavConfig
57
+ );
58
+ }
59
+
28
60
/**
29
61
* @var LinkFactory
30
62
*/
@@ -47,7 +79,6 @@ protected function prepareProduct($product, $data)
47
79
$ bundleOptionsData = $ product ->getBundleOptionsData ();
48
80
$ options = [];
49
81
foreach ($ bundleOptionsData as $ key => $ optionData ) {
50
-
51
82
$ option = $ this ->getOptionFactory ()->create (['data ' => $ optionData ]);
52
83
$ option ->setSku ($ product ->getSku ());
53
84
$ option ->setOptionId (null );
@@ -87,7 +118,7 @@ private function getOptionFactory()
87
118
88
119
if (!($ this ->optionFactory )) {
89
120
return ObjectManager::getInstance ()->get (
90
- '\Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks '
121
+ '\Magento\Bundle\Api\Data\OptionInterfaceFactory '
91
122
);
92
123
} else {
93
124
return $ this ->optionFactory ;
@@ -105,7 +136,7 @@ private function getLinkFactory()
105
136
106
137
if (!($ this ->linkFactory )) {
107
138
return ObjectManager::getInstance ()->get (
108
- '\Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks '
139
+ '\Magento\Bundle\Api\Data\LinkInterfaceFactory '
109
140
);
110
141
} else {
111
142
return $ this ->linkFactory ;
@@ -123,7 +154,7 @@ private function getProductRepository()
123
154
124
155
if (!($ this ->productRepository )) {
125
156
return ObjectManager::getInstance ()->get (
126
- '\Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks '
157
+ '\Magento\Catalog\Api\ProductRepositoryInterface '
127
158
);
128
159
} else {
129
160
return $ this ->productRepository ;
0 commit comments