Last active
October 10, 2022 11:44
-
-
Save magevision/e528b6a736d5bf5a28b88ddb5a3ed17e to your computer and use it in GitHub Desktop.
StoreConfigurationUsingDataPatch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace MageVision\Blog79\Setup\Patch\Data; | |
use Magento\Framework\Setup\ModuleDataSetupInterface; | |
use Magento\Framework\Setup\Patch\DataPatchInterface; | |
use Magento\Config\Model\ResourceModel\Config as ResourceConfig; | |
class SetStoreConfiguration implements DataPatchInterface | |
{ | |
private ModuleDataSetupInterface $moduleDataSetup; | |
private ResourceConfig $resourceConfig; | |
/** | |
* @param ModuleDataSetupInterface $moduleDataSetup | |
* @param ResourceConfig $resourceConfig | |
*/ | |
public function __construct( | |
ModuleDataSetupInterface $moduleDataSetup, | |
ResourceConfig $resourceConfig | |
) { | |
$this->moduleDataSetup = $moduleDataSetup; | |
$this->resourceConfig = $resourceConfig; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function apply() | |
{ | |
$this->moduleDataSetup->startSetup(); | |
$this->resourceConfig->saveConfig('general/locale/timezone', 'Europe/Berlin'); | |
$this->moduleDataSetup->endSetup(); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public static function getDependencies() | |
{ | |
return []; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getAliases() | |
{ | |
return []; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment