Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit d78ae56

Browse files
committed
Add ObjectManager to ConfigDataFactory
ObjectManager is used in ConfigDataFactory to create new instances of ConfigData
1 parent c868fa2 commit d78ae56

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/internal/Magento/Framework/Config/Data/ConfigDataFactory.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,30 @@
66

77
namespace Magento\Framework\Config\Data;
88

9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\Framework\ObjectManagerInterface;
11+
912
/**
1013
* Factory for ConfigData
1114
* @api
1215
*/
1316
class ConfigDataFactory
1417
{
18+
/**
19+
* @var ObjectManager
20+
*/
21+
private $objectManager;
22+
23+
/**
24+
* Factory constructor
25+
*
26+
* @param ObjectManagerInterface $objectManager
27+
*/
28+
public function __construct(ObjectManagerInterface $objectManager)
29+
{
30+
$this->objectManager = $objectManager;
31+
}
32+
1533
/**
1634
* Returns a new instance of ConfigData on every call.
1735
*
@@ -20,6 +38,6 @@ class ConfigDataFactory
2038
*/
2139
public function create(string $fileKey) : ConfigData
2240
{
23-
return new ConfigData($fileKey);
41+
return $this->objectManager->create(ConfigData::class, ['fileKey' => $fileKey]);
2442
}
2543
}

0 commit comments

Comments
 (0)