Skip to content

Commit 67556cf

Browse files
committed
B2B-2677: [MediaGallery] Implement data caching for GraphQL results on resolver level
- Fix PHPStan "Cannot unset offset 'entity_id' on array{extension_attributes: array{video_content: mixed}}."
1 parent 92f8c48 commit 67556cf

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,17 @@ function (ProductInterface $product) {
389389
$videoContent = $galleryEntry->getExtensionAttributes()->getVideoContent();
390390

391391
$galleryEntryArray = $galleryEntry->toArray();
392-
$galleryEntryArray['extension_attributes'] = [
393-
'video_content' => $videoContent->toArray(),
394-
];
392+
$videoContentArray = $videoContent->toArray();
395393

396394
// unset properties of gallery that are not accepted by the API
397-
unset($galleryEntryArray['entity_id']);
398-
unset($galleryEntryArray['extension_attributes']['video_content']['entity_id']);
395+
unset(
396+
$galleryEntryArray['entity_id'],
397+
$videoContentArray['entity_id']
398+
);
399+
400+
$galleryEntryArray['extension_attributes'] = [
401+
'video_content' => $videoContentArray,
402+
];
399403

400404
// update label
401405
$galleryEntryArray['label'] = 'new label';

0 commit comments

Comments
 (0)