6
6
namespace Magento \OfflineShippingSampleData \Model ;
7
7
8
8
use Magento \Framework \Setup \SampleData \Context as SampleDataContext ;
9
+ use Magento \Framework \App \ObjectManager ;
10
+ use Magento \Config \App \Config \Type \System as SystemConfig ;
9
11
10
12
/**
11
13
* Class Tablerate
@@ -57,14 +59,20 @@ class Tablerate
57
59
*/
58
60
protected $ storeManager ;
59
61
62
+ /**
63
+ * @var SystemConfig
64
+ */
65
+ private $ systemConfig ;
66
+
60
67
/**
61
68
* @param SampleDataContext $sampleDataContext
62
69
* @param \Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate $tablerate
63
- * @param \Magento\Framework\App\ResourceModel $resource
70
+ * @param \Magento\Framework\App\ResourceConnection $resource
64
71
* @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
65
72
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
66
73
* @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
67
74
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
75
+ * @param SystemConfig|null $systemConfig
68
76
*/
69
77
public function __construct (
70
78
SampleDataContext $ sampleDataContext ,
@@ -73,7 +81,8 @@ public function __construct(
73
81
\Magento \Directory \Model \ResourceModel \Region \CollectionFactory $ regionCollectionFactory ,
74
82
\Magento \Framework \App \Cache \TypeListInterface $ cacheTypeList ,
75
83
\Magento \Framework \App \Config \Storage \WriterInterface $ configWriter ,
76
- \Magento \Store \Model \StoreManagerInterface $ storeManager
84
+ \Magento \Store \Model \StoreManagerInterface $ storeManager ,
85
+ SystemConfig $ systemConfig = null
77
86
) {
78
87
$ this ->fixtureManager = $ sampleDataContext ->getFixtureManager ();
79
88
$ this ->csvReader = $ sampleDataContext ->getCsvReader ();
@@ -83,6 +92,7 @@ public function __construct(
83
92
$ this ->cacheTypeList = $ cacheTypeList ;
84
93
$ this ->configWriter = $ configWriter ;
85
94
$ this ->storeManager = $ storeManager ;
95
+ $ this ->systemConfig = $ systemConfig ?: ObjectManager::getInstance ()->get (SystemConfig::class);
86
96
}
87
97
88
98
/**
@@ -138,6 +148,7 @@ public function install(array $fixtures)
138
148
$ this ->configWriter ->save ('carriers/tablerate/active ' , 1 );
139
149
$ this ->configWriter ->save ('carriers/tablerate/condition_name ' , 'package_value ' );
140
150
$ this ->cacheTypeList ->cleanType ('config ' );
151
+ $ this ->systemConfig ->clean ();
141
152
}
142
153
143
154
/**
0 commit comments