Skip to content

Commit 0fa74d5

Browse files
ENGCOM-7740: #27952: missing store_name in GraphQL resolver - adde… #28855
- Merge Pull Request #28855 from sasha19957099/magento2:27952_Missing_store_name_in_GraphQl_Resolver - Merged commits: 1. 85db11d 2. 096aa37 3. de9ff7d 4. 1e6c55a 5. 42c534c 6. c3e38ac
2 parents 5d3d5c7 + c3e38ac commit 0fa74d5

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

app/code/Magento/Store/Api/Data/StoreConfigInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Store\Api\Data;
77

88
/**
9-
* StoreConfig interface
9+
* Interface for store config
1010
*
1111
* @api
1212
* @since 100.0.2
@@ -141,7 +141,7 @@ public function setWeightUnit($weightUnit);
141141
public function getBaseUrl();
142142

143143
/**
144-
* set base URL
144+
* Set base URL
145145
*
146146
* @param string $baseUrl
147147
* @return $this
@@ -201,7 +201,7 @@ public function setBaseMediaUrl($baseMediaUrl);
201201
public function getSecureBaseUrl();
202202

203203
/**
204-
* set secure base URL
204+
* Set secure base URL
205205
*
206206
* @param string $secureBaseUrl
207207
* @return $this

app/code/Magento/Store/Model/Data/StoreConfig.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Store\Model\Data;
77

88
/**
9-
* Class StoreConfig
9+
* Allows to get and set store config values
1010
*
1111
* @codeCoverageIgnore
1212
*/
@@ -188,7 +188,7 @@ public function getBaseUrl()
188188
}
189189

190190
/**
191-
* set base URL
191+
* Set base URL
192192
*
193193
* @param string $baseUrl
194194
* @return $this
@@ -293,7 +293,7 @@ public function getSecureBaseUrl()
293293
}
294294

295295
/**
296-
* set secure base URL
296+
* Set secure base URL
297297
*
298298
* @param string $secureBaseUrl
299299
* @return $this
@@ -367,7 +367,7 @@ public function setSecureBaseMediaUrl($secureBaseMediaUrl)
367367
}
368368

369369
/**
370-
* {@inheritdoc}
370+
* @inheritdoc
371371
*
372372
* @return \Magento\Store\Api\Data\StoreConfigExtensionInterface|null
373373
*/
@@ -377,7 +377,7 @@ public function getExtensionAttributes()
377377
}
378378

379379
/**
380-
* {@inheritdoc}
380+
* @inheritdoc
381381
*
382382
* @param \Magento\Store\Api\Data\StoreConfigExtensionInterface $extensionAttributes
383383
* @return $this

app/code/Magento/Store/Model/Service/StoreConfigManager.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Store\Model\Service;
77

8+
/**
9+
* Allows to get store config
10+
*/
811
class StoreConfigManager implements \Magento\Store\Api\StoreConfigManagerInterface
912
{
1013
/**
@@ -53,6 +56,8 @@ public function __construct(
5356
}
5457

5558
/**
59+
* Get store configs
60+
*
5661
* @param string[] $storeCodes list of stores by store codes, will return all if storeCodes is not set
5762
* @return \Magento\Store\Api\Data\StoreConfigInterface[]
5863
*/
@@ -71,6 +76,8 @@ public function getStoreConfigs(array $storeCodes = null)
7176
}
7277

7378
/**
79+
* Get store config
80+
*
7481
* @param \Magento\Store\Model\Store $store
7582
* @return \Magento\Store\Api\Data\StoreConfigInterface
7683
*/

app/code/Magento/StoreGraphQl/Model/Resolver/Store/StoreConfigDataProvider.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ public function __construct(
5555
*/
5656
public function getStoreConfigData(StoreInterface $store): array
5757
{
58-
$storeConfigData = array_merge(
58+
return array_merge(
5959
$this->getBaseConfigData($store),
6060
$this->getExtendedConfigData((int)$store->getId())
6161
);
62-
return $storeConfigData;
6362
}
6463

6564
/**
@@ -72,7 +71,7 @@ private function getBaseConfigData(StoreInterface $store) : array
7271
{
7372
$storeConfig = current($this->storeConfigManager->getStoreConfigs([$store->getCode()]));
7473

75-
$storeConfigData = [
74+
return [
7675
'id' => $storeConfig->getId(),
7776
'code' => $storeConfig->getCode(),
7877
'website_id' => $storeConfig->getWebsiteId(),
@@ -88,9 +87,9 @@ private function getBaseConfigData(StoreInterface $store) : array
8887
'secure_base_url' => $storeConfig->getSecureBaseUrl(),
8988
'secure_base_link_url' => $storeConfig->getSecureBaseLinkUrl(),
9089
'secure_base_static_url' => $storeConfig->getSecureBaseStaticUrl(),
91-
'secure_base_media_url' => $storeConfig->getSecureBaseMediaUrl()
90+
'secure_base_media_url' => $storeConfig->getSecureBaseMediaUrl(),
91+
'store_name' => $store->getName()
9292
];
93-
return $storeConfigData;
9493
}
9594

9695
/**

app/code/Magento/StoreGraphQl/etc/graphql/di.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,4 @@
2323
</argument>
2424
</arguments>
2525
</type>
26-
<type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider">
27-
<arguments>
28-
<argument name="extendedConfigData" xsi:type="array">
29-
<item name="store_name" xsi:type="string">store/information/name</item>
30-
</argument>
31-
</arguments>
32-
</type>
3326
</config>

dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreConfigResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ public function testGetStoreConfig()
9191
$response['storeConfig']['secure_base_static_url']
9292
);
9393
$this->assertEquals($storeConfig->getSecureBaseMediaUrl(), $response['storeConfig']['secure_base_media_url']);
94-
$this->assertEquals('Test Store', $response['storeConfig']['store_name']);
94+
$this->assertEquals($store->getName(), $response['storeConfig']['store_name']);
9595
}
9696
}

0 commit comments

Comments
 (0)