Skip to content

Commit 8e21aef

Browse files
committed
ACPT-826
1 parent 19daa6d commit 8e21aef

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

app/code/Magento/AsyncConfig/Plugin/Controller/System/Config/SaveAsyncConfigPlugin.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\AsyncConfig\Setup\ConfigOptionsList;
1212
use Magento\Config\Controller\Adminhtml\System\Config\Save;
1313
use Magento\Framework\App\DeploymentConfig;
14-
use Magento\Framework\App\ObjectManager;
1514
use Magento\Framework\Controller\Result\RedirectFactory;
1615
use Magento\Framework\Exception\FileSystemException;
1716
use Magento\Framework\Exception\LocalizedException;
@@ -42,21 +41,19 @@ class SaveAsyncConfigPlugin
4241

4342
/**
4443
*
45-
* @param DeploymentConfig|null $deploymentConfig
46-
* @param AsyncConfigPublisherInterface|null $asyncConfigPublisher
44+
* @param DeploymentConfig $deploymentConfig
45+
* @param AsyncConfigPublisherInterface $asyncConfigPublisher
4746
* @param RedirectFactory $resultRedirectFactory
4847
* @param ManagerInterface $messageManager
4948
*/
5049
public function __construct(
51-
DeploymentConfig $deploymentConfig = null,
52-
AsyncConfigPublisherInterface $asyncConfigPublisher = null,
50+
DeploymentConfig $deploymentConfig,
51+
AsyncConfigPublisherInterface $asyncConfigPublisher,
5352
RedirectFactory $resultRedirectFactory,
5453
ManagerInterface $messageManager
5554
) {
56-
$this->deploymentConfig = $deploymentConfig
57-
?? ObjectManager::getInstance()->get(DeploymentConfig::class);
58-
$this->asyncConfigPublisher = $asyncConfigPublisher
59-
?? ObjectManager::getInstance()->get(AsyncConfigPublisherInterface::class);
55+
$this->deploymentConfig = $deploymentConfig;
56+
$this->asyncConfigPublisher = $asyncConfigPublisher;
6057
$this->resultRedirectFactory = $resultRedirectFactory;
6158
$this->messageManager = $messageManager;
6259
}

app/code/Magento/AsyncConfig/Setup/ConfigOptionsList.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
namespace Magento\AsyncConfig\Setup;
99

1010
use Magento\Framework\App\DeploymentConfig;
11-
use Magento\Framework\Config\Data\ConfigData;
11+
use Magento\Framework\App\ObjectManager;
12+
use Magento\Framework\Config\Data\ConfigDataFactory;
1213
use Magento\Framework\Config\File\ConfigFilePool;
1314
use Magento\Framework\Setup\ConfigOptionsListInterface;
1415
use Magento\Framework\Setup\Option\SelectConfigOption;
@@ -40,6 +41,20 @@ class ConfigOptionsList implements ConfigOptionsListInterface
4041
*/
4142
private $selectOptions = [0, 1];
4243

44+
/**
45+
* @var ConfigDataFactory
46+
*/
47+
private $configDataFactory;
48+
49+
/**
50+
* @param ConfigDataFactory $configDataFactory
51+
*/
52+
public function __construct(
53+
ConfigDataFactory $configDataFactory
54+
) {
55+
$this->configDataFactory = $configDataFactory;
56+
}
57+
4358
/**
4459
* @inheritdoc
4560
*/
@@ -62,7 +77,7 @@ public function getOptions()
6277
*/
6378
public function createConfig(array $data, DeploymentConfig $deploymentConfig)
6479
{
65-
$configData = new ConfigData(ConfigFilePool::APP_ENV);
80+
$configData = $this->configDataFactory->create(ConfigFilePool::APP_ENV);
6681

6782
if (!$this->isDataEmpty($data, self::INPUT_KEY_ASYNC_CONFIG_SAVE)) {
6883
$configData->set(

0 commit comments

Comments
 (0)