Skip to content

Commit 0c7166e

Browse files
MAGETWO-69535: Error during importing new list of scopes through shared file
1 parent d3370da commit 0c7166e

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Store\App\Config;
7+
8+
use Magento\Framework\App\Config\ConfigSourceInterface;
9+
use Magento\Framework\App\DeploymentConfig;
10+
use Magento\Framework\App\DeploymentConfig\Reader;
11+
use Magento\Framework\DataObject;
12+
13+
class InitialConfigSource implements ConfigSourceInterface
14+
{
15+
/**
16+
* @var Reader
17+
*/
18+
private $reader;
19+
20+
/**
21+
* @var DeploymentConfig
22+
*/
23+
private $deploymentConfig;
24+
25+
/**
26+
* @var string
27+
*/
28+
private $configType;
29+
30+
/**
31+
* DataProvider constructor.
32+
*
33+
* @param Reader $reader
34+
* @param DeploymentConfig $deploymentConfig
35+
* @param string $configType
36+
*/
37+
public function __construct(Reader $reader, DeploymentConfig $deploymentConfig, $configType)
38+
{
39+
$this->reader = $reader;
40+
$this->deploymentConfig = $deploymentConfig;
41+
$this->configType = $configType;
42+
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
public function get($path = '')
48+
{
49+
/**
50+
* Magento store configuration should not be read from file source
51+
* on installed instance.
52+
*
53+
* @see \Magento\Store\Model\Config\Importer To import store configs
54+
*/
55+
if ($this->deploymentConfig->isAvailable()) {
56+
return [];
57+
}
58+
59+
$data = new DataObject($this->reader->load());
60+
if ($path !== '' && $path !== null) {
61+
$path = '/' . $path;
62+
}
63+
64+
return $data->getData($this->configType . $path) ?: [];
65+
}
66+
}

0 commit comments

Comments
 (0)