|
6 | 6 | namespace Magento\CatalogSampleData\Model\Product;
|
7 | 7 |
|
8 | 8 | use Magento\Catalog\Model\ProductFactory;
|
9 |
| -use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Media as GalleryAttribute; |
| 9 | +use Magento\Catalog\Model\ResourceModel\Product\Gallery as GalleryResource; |
10 | 10 | use Magento\Framework\Setup\SampleData\Context as SampleDataContext;
|
11 | 11 |
|
12 | 12 | /**
|
@@ -47,18 +47,18 @@ class Gallery
|
47 | 47 | /**
|
48 | 48 | * @param SampleDataContext $sampleDataContext
|
49 | 49 | * @param ProductFactory $productFactory
|
50 |
| - * @param GalleryAttribute $galleryAttribute |
| 50 | + * @param GalleryResource $galleryResource |
51 | 51 | * @param \Magento\Eav\Model\Config $eavConfig
|
52 | 52 | */
|
53 | 53 | public function __construct(
|
54 | 54 | SampleDataContext $sampleDataContext,
|
55 | 55 | ProductFactory $productFactory,
|
56 |
| - GalleryAttribute $galleryAttribute, |
| 56 | + GalleryResource $galleryResource, |
57 | 57 | \Magento\Eav\Model\Config $eavConfig
|
58 | 58 | ) {
|
59 | 59 | $this->fixtureManager = $sampleDataContext->getFixtureManager();
|
60 | 60 | $this->csvReader = $sampleDataContext->getCsvReader();
|
61 |
| - $this->galleryAttribute = $galleryAttribute; |
| 61 | + $this->galleryResource = $galleryResource; |
62 | 62 | $this->productFactory = $productFactory;
|
63 | 63 | $this->eavConfig = $eavConfig;
|
64 | 64 | }
|
@@ -122,20 +122,20 @@ protected function storeImage($product, $images)
|
122 | 122 | if (strpos($image, '_main') !== false) {
|
123 | 123 | $baseImage = $image;
|
124 | 124 | }
|
125 |
| - $id = $this->galleryAttribute->insertGallery([ |
| 125 | + $id = $this->galleryResource->insertGallery([ |
126 | 126 | 'attribute_id' => $mediaAttribute->getAttributeId(),
|
127 | 127 | 'entity_id' => $product->getId(),
|
128 | 128 | 'value' => $image,
|
129 | 129 | ]);
|
130 |
| - $this->galleryAttribute->insertGalleryValueInStore([ |
| 130 | + $this->galleryResource->insertGalleryValueInStore([ |
131 | 131 | 'value_id' => $id,
|
132 | 132 | 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
|
133 | 133 | 'entity_id' => $product->getId(),
|
134 | 134 | 'label' => 'Image',
|
135 | 135 | 'position' => $i,
|
136 | 136 | 'disables' => 0,
|
137 | 137 | ]);
|
138 |
| - $this->galleryAttribute->bindValueToEntity($id, $product->getId()); |
| 138 | + $this->galleryResource->bindValueToEntity($id, $product->getId()); |
139 | 139 | $i++;
|
140 | 140 | }
|
141 | 141 |
|
|
0 commit comments