Skip to content

Commit d6a8ff9

Browse files
committed
Merge remote-tracking branch 'epam/MAGETWO-90021' into BugFixPR
2 parents 2564fc2 + c30ab0c commit d6a8ff9

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76

87
namespace Magento\Catalog\Model\Product\Gallery;
98

109
use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface;
11-
use Magento\Catalog\Api\Data\ProductInterface as Product;
1210
use Magento\Framework\Exception\InputException;
1311
use Magento\Framework\Exception\NoSuchEntityException;
1412
use Magento\Framework\Exception\StateException;
1513
use Magento\Framework\Api\ImageContentValidatorInterface;
1614

1715
/**
16+
* Class GalleryManagement
17+
*
18+
* Provides implementation of api interface ProductAttributeMediaGalleryManagementInterface
19+
*
1820
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1921
*/
2022
class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface
@@ -44,7 +46,7 @@ public function __construct(
4446
}
4547

4648
/**
47-
* {@inheritdoc}
49+
* @inheritdoc
4850
*/
4951
public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry)
5052
{
@@ -54,7 +56,7 @@ public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry)
5456
if (!$this->contentValidator->isValid($entryContent)) {
5557
throw new InputException(__('The image content is invalid. Verify the content and try again.'));
5658
}
57-
$product = $this->productRepository->get($sku);
59+
$product = $this->productRepository->get($sku, true);
5860

5961
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
6062
$existingEntryIds = [];
@@ -84,11 +86,11 @@ public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry)
8486
}
8587

8688
/**
87-
* {@inheritdoc}
89+
* @inheritdoc
8890
*/
8991
public function update($sku, ProductAttributeMediaGalleryEntryInterface $entry)
9092
{
91-
$product = $this->productRepository->get($sku);
93+
$product = $this->productRepository->get($sku, true);
9294
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
9395
if ($existingMediaGalleryEntries == null) {
9496
throw new NoSuchEntityException(
@@ -125,11 +127,11 @@ public function update($sku, ProductAttributeMediaGalleryEntryInterface $entry)
125127
}
126128

127129
/**
128-
* {@inheritdoc}
130+
* @inheritdoc
129131
*/
130132
public function remove($sku, $entryId)
131133
{
132-
$product = $this->productRepository->get($sku);
134+
$product = $this->productRepository->get($sku, true);
133135
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
134136
if ($existingMediaGalleryEntries == null) {
135137
throw new NoSuchEntityException(
@@ -155,7 +157,7 @@ public function remove($sku, $entryId)
155157
}
156158

157159
/**
158-
* {@inheritdoc}
160+
* @inheritdoc
159161
*/
160162
public function get($sku, $entryId)
161163
{
@@ -176,7 +178,7 @@ public function get($sku, $entryId)
176178
}
177179

178180
/**
179-
* {@inheritdoc}
181+
* @inheritdoc
180182
*/
181183
public function getList($sku)
182184
{

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ public function testQueryAllFieldsSimpleProduct()
285285
*/
286286
public function testQueryMediaGalleryEntryFieldsSimpleProduct()
287287
{
288-
$this->markTestSkipped("Skipped until ticket MAGETWO-90021 is resolved.");
289288
$productSku = 'simple';
290289

291290
$query = <<<QUERY
@@ -484,7 +483,7 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct()
484483
QUERY;
485484

486485
$response = $this->graphQlQuery($query);
487-
486+
488487
/**
489488
* @var ProductRepositoryInterface $productRepository
490489
*/

0 commit comments

Comments
 (0)