66namespace Magento \OfflineShippingSampleData \Model ;
77
88use Magento \Framework \Setup \SampleData \Context as SampleDataContext ;
9+ use Magento \Framework \App \ObjectManager ;
10+ use Magento \Config \App \Config \Type \System as SystemConfig ;
911
1012/**
1113 * Class Tablerate
@@ -57,14 +59,20 @@ class Tablerate
5759 */
5860 protected $ storeManager ;
5961
62+ /**
63+ * @var SystemConfig
64+ */
65+ private $ systemConfig ;
66+
6067 /**
6168 * @param SampleDataContext $sampleDataContext
6269 * @param \Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate $tablerate
63- * @param \Magento\Framework\App\ResourceModel $resource
70+ * @param \Magento\Framework\App\ResourceConnection $resource
6471 * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
6572 * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
6673 * @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
6774 * @param \Magento\Store\Model\StoreManagerInterface $storeManager
75+ * @param SystemConfig|null $systemConfig
6876 */
6977 public function __construct (
7078 SampleDataContext $ sampleDataContext ,
@@ -73,7 +81,8 @@ public function __construct(
7381 \Magento \Directory \Model \ResourceModel \Region \CollectionFactory $ regionCollectionFactory ,
7482 \Magento \Framework \App \Cache \TypeListInterface $ cacheTypeList ,
7583 \Magento \Framework \App \Config \Storage \WriterInterface $ configWriter ,
76- \Magento \Store \Model \StoreManagerInterface $ storeManager
84+ \Magento \Store \Model \StoreManagerInterface $ storeManager ,
85+ SystemConfig $ systemConfig = null
7786 ) {
7887 $ this ->fixtureManager = $ sampleDataContext ->getFixtureManager ();
7988 $ this ->csvReader = $ sampleDataContext ->getCsvReader ();
@@ -83,6 +92,7 @@ public function __construct(
8392 $ this ->cacheTypeList = $ cacheTypeList ;
8493 $ this ->configWriter = $ configWriter ;
8594 $ this ->storeManager = $ storeManager ;
95+ $ this ->systemConfig = $ systemConfig ?: ObjectManager::getInstance ()->get (SystemConfig::class);
8696 }
8797
8898 /**
@@ -138,6 +148,7 @@ public function install(array $fixtures)
138148 $ this ->configWriter ->save ('carriers/tablerate/active ' , 1 );
139149 $ this ->configWriter ->save ('carriers/tablerate/condition_name ' , 'package_value ' );
140150 $ this ->cacheTypeList ->cleanType ('config ' );
151+ $ this ->systemConfig ->clean ();
141152 }
142153
143154 /**
0 commit comments