Skip to content

Commit 0247496

Browse files
committed
Merge branch 'PR-35392' into B2B-2487
# Conflicts: # app/code/Magento/StoreGraphQl/etc/schema.graphqls
2 parents 9ef88b4 + 432228c commit 0247496

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\StoreGraphQl\Model\Resolver\Store;
9+
10+
use Magento\Framework\GraphQl\Query\Resolver\IdentityInterface;
11+
use Magento\Framework\App\Config;
12+
13+
class Identity implements IdentityInterface
14+
{
15+
/**
16+
* @var string
17+
*/
18+
private $cacheTag = Config::CACHE_TAG;
19+
20+
/**
21+
* @inheritDoc
22+
*/
23+
public function getIdentities(array $resolvedData): array
24+
{
25+
$data["id"] = empty($resolvedData) ? [] : $resolvedData["id"];
26+
$ids = empty($resolvedData) ?
27+
[] : array_merge([$this->cacheTag], array_map(function ($key) {
28+
return sprintf('%s_%s', $this->cacheTag, $key);
29+
}, $data));
30+
return $ids;
31+
}
32+
}

app/code/Magento/StoreGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright © Magento, Inc. All rights reserved.
22
# See COPYING.txt for license details.
33
type Query {
4-
storeConfig : StoreConfig @resolver(class: "Magento\\StoreGraphQl\\Model\\Resolver\\StoreConfigResolver") @doc(description: "Return details about the store's configuration.") @cache(cacheable: false)
4+
storeConfig : StoreConfig @resolver(class: "Magento\\StoreGraphQl\\Model\\Resolver\\StoreConfigResolver") @doc(description: "Return details about the store's configuration.") @cache(cacheIdentity: "Magento\\StoreGraphQl\\Model\\Resolver\\Store\\Identity")
55
availableStores(
66
useCurrentGroup: Boolean @doc(description: "Filter store views by the current store group.")
77
): [StoreConfig] @resolver(class: "Magento\\StoreGraphQl\\Model\\Resolver\\AvailableStoresResolver") @doc(description: "Get a list of available store views and their config information.")

0 commit comments

Comments
 (0)