Skip to content

Commit 5376c17

Browse files
committed
B2B-2677: [MediaGallery]Implement data caching for GraphQL results on resolver level
- Revert fetching product from DB
1 parent bc0353d commit 5376c17

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

app/code/Magento/CatalogGraphQl/Plugin/Product/UpdateIdentities.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CatalogGraphQl\Plugin\Product;
99

10-
use Magento\Catalog\Api\ProductRepositoryInterface;
1110
use Magento\Catalog\Model\Product;
1211
use Magento\CatalogGraphQl\Model\Resolver\Cache\Product\MediaGallery\ResolverCacheIdentity;
1312
use Magento\Framework\Serialize\SerializerInterface;
@@ -18,25 +17,17 @@
1817
*/
1918
class UpdateIdentities
2019
{
21-
/**
22-
* @var ProductRepositoryInterface
23-
*/
24-
private $productRepository;
25-
2620
/**
2721
* @var SerializerInterface
2822
*/
2923
private $serializer;
3024

3125
/**
32-
* @param ProductRepositoryInterface $productRepository
3326
* @param SerializerInterface $serializer
3427
*/
3528
public function __construct(
36-
ProductRepositoryInterface $productRepository,
3729
SerializerInterface $serializer
3830
) {
39-
$this->productRepository = $productRepository;
4031
$this->serializer = $serializer;
4132
}
4233

@@ -67,12 +58,7 @@ private function isMediaGalleryChanged(Product $product): bool
6758
return false;
6859
}
6960

70-
$mediaGalleryImages = $this->productRepository->get(
71-
$product->getSku(),
72-
false,
73-
null,
74-
true
75-
)->getMediaGallery('images') ?? [];
61+
$mediaGalleryImages = $product->getMediaGallery('images') ?? [];
7662

7763
$origMediaGalleryImages = $product->getOrigData('media_gallery')['images'] ?? [];
7864

0 commit comments

Comments
 (0)