Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
website_configuration_rollback.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
15 
16 $objectManager = Bootstrap::getObjectManager();
17 
18 $deleteConfigData = function (WriterInterface $writer, $scope, $scopeId) {
19  $configData = [
20  'fraud_protection/signifyd/active',
21  ];
22  foreach ($configData as $path) {
23  $writer->delete($path, $scope, $scopeId);
24  }
25 };
26 
28 $configWriter = $objectManager->get(WriterInterface::class);
29 $deleteConfigData($configWriter, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null);
30 
32 $websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
33 $website = $websiteRepository->get('test_website');
34 $deleteConfigData($configWriter, ScopeInterface::SCOPE_WEBSITES, $website->getId());
35 
36 $website = $objectManager->create(Website::class);
38 if ($website->load('test_website', 'code')->getId()) {
39  $website->delete();
40 }
41 $store = $objectManager->create(Store::class);
42 if ($store->load('test_second_store', 'code')->getId()) {
43  $store->delete();
44 }
if($website->load('test_website', 'code') ->getId()) $store
delete($path, $scope=ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeId=0)