Skip to content

Commit d3370da

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

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

app/code/Magento/Store/Model/Config/Importer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public function __construct(
8484
public function import(array $data)
8585
{
8686
$actions = [
87-
ProcessorFactory::TYPE_DELETE,
8887
ProcessorFactory::TYPE_CREATE,
88+
ProcessorFactory::TYPE_DELETE,
8989
ProcessorFactory::TYPE_UPDATE
9090
];
9191
$messages = ['Stores were processed'];

app/code/Magento/Store/Model/Config/Importer/Processor/Create.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,20 @@ public function run(array $data)
125125
private function createWebsites(array $items, array $data)
126126
{
127127
foreach ($items as $websiteData) {
128-
unset($websiteData['website_id']);
128+
$groupId = $websiteData['default_group_id'];
129+
130+
unset(
131+
$websiteData['website_id'],
132+
$websiteData['default_group_id']
133+
);
129134

130135
$website = $this->websiteFactory->create();
131136
$website->setData($websiteData);
132137
$website->getResource()->save($website);
133138

134-
$website->getResource()->addCommitCallback(function () use ($website, $data) {
139+
$website->getResource()->addCommitCallback(function () use ($website, $data, $groupId) {
135140
$website->setDefaultGroupId(
136-
$this->detectGroupById($data, $website->getDefaultGroupId())->getId()
141+
$this->detectGroupById($data, $groupId)->getId()
137142
);
138143
$website->getResource()->save($website);
139144
});

app/code/Magento/Store/etc/di.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,10 @@
346346
</argument>
347347
</arguments>
348348
</virtualType>
349-
<virtualType name="scopesConfigInitialDataProvider" type="Magento\Framework\App\Config\InitialConfigSource">
349+
<virtualType name="scopesConfigInitialDataProvider" type="Magento\Store\App\Config\InitialConfigSource">
350350
<arguments>
351351
<argument name="reader" xsi:type="object">Magento\Framework\App\DeploymentConfig\Reader</argument>
352352
<argument name="configType" xsi:type="const">Magento\Store\App\Config\Type\Scopes::CONFIG_TYPE</argument>
353-
<argument name="fileKey" xsi:type="const">Magento\Framework\Config\File\ConfigFilePool::APP_CONFIG</argument>
354353
</arguments>
355354
</virtualType>
356355
<type name="Magento\Deploy\Console\Command\App\ApplicationDumpCommand">

0 commit comments

Comments
 (0)