Skip to content

Commit 14fae58

Browse files
author
Bohdan Korablov
committed
MAGETWO-63382: CLI Improvements: Configuration management - Command config:show
1 parent 8bb3382 commit 14fae58

File tree

4 files changed

+30
-14
lines changed

4 files changed

+30
-14
lines changed

app/code/Magento/Config/Console/Command/ConfigShow/ValueProcessor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
use Magento\Framework\App\Area;
1515

1616
/**
17-
* Class processes values using backend model.
18-
*
19-
* Backend model is gotten from field via its path (e.g. scope_id/group_id/field_id).
17+
* Class processes values using backend model which declared in system.xml.
2018
*/
2119
class ValueProcessor
2220
{

lib/internal/Magento/Framework/App/Config/ConfigPathResolver.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Magento\Store\Model\ScopeInterface;
99

1010
/**
11-
* Resolves config path by input parameters.
11+
* Configures full path for configurations, including scope data and configuration type.
1212
*/
1313
class ConfigPathResolver
1414
{
@@ -31,19 +31,22 @@ public function __construct(ScopeCodeResolver $scopeCodeResolver)
3131
*
3232
* @param string $path The path of configuration
3333
* @param string $scope The scope of configuration
34-
* @param string|int|null $scopeCode The scope code or identifier of configuration
35-
* @param string|null $type The type of configuration
34+
* @param string|int|null $scopeCode The scope code or its identifier of configuration. The values for this
35+
* field are taken from 'store' or 'store_website' tables, depends on $scope value
36+
* @param string|null $type The type of configuration.
37+
* The available types are declared in implementations of Magento\Framework\App\Config\ConfigTypeInterface
38+
* E.g.
39+
* ```php
40+
* const CONFIG_TYPE = 'system';
41+
* ```
3642
* @return string Resolved configuration path
3743
*/
3844
public function resolve($path, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null, $type = null)
3945
{
4046
$path = trim($path, '/');
4147
$scope = rtrim($scope, 's');
4248

43-
/**
44-
* Scope name is currently stored in plural form.
45-
* Desired behavior will be changed in mayor release.
46-
*/
49+
/** Scope name is currently stored in plural form. */
4750
if (in_array($scope, [ScopeInterface::SCOPE_STORE, ScopeInterface::SCOPE_WEBSITE])) {
4851
$scope .= 's';
4952
}
@@ -58,6 +61,6 @@ public function resolve($path, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT
5861
$scopePath .= '/' . $scopeCode;
5962
}
6063

61-
return trim($scopePath . '/' . $path, '/');
64+
return $scopePath . ($path ? '/' . $path : '');
6265
}
6366
}

lib/internal/Magento/Framework/App/Config/ConfigSourceAggregated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function get($path = '')
4040
$configData = $source->get($path);
4141
if (!is_array($configData)) {
4242
$data = $configData;
43-
} elseif(!empty($configData)) {
43+
} elseif (!empty($configData)) {
4444
$data = array_replace_recursive(is_array($data) ? $data : [], $configData);
4545
}
4646
}

lib/internal/Magento/Framework/App/Config/ConfigSourceInterface.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,23 @@ interface ConfigSourceInterface
1515
/**
1616
* Retrieve configuration raw data array.
1717
*
18-
* @param string $path
19-
* @return string|array
18+
* @param string $path The configuration path (e.g. section_id/group_id/field_id)
19+
* @return string|array Array will be returned if you use part of path (e.g. scope/scope_code/section_id)
20+
* ```php
21+
* [
22+
* 'group1' =>
23+
* [
24+
* 'field1' => 'value1',
25+
* 'field2' => 'value2'
26+
* ],
27+
* 'group2' =>
28+
* [
29+
* 'field1' => 'value3'
30+
* ]
31+
* ]
32+
* ```
33+
* And string will be returned if you use full path to field (e.g. scope/scope_code/section_id/group_id/field_id)
34+
* E.g. 'value1'
2035
*/
2136
public function get($path = '');
2237
}

0 commit comments

Comments
 (0)