I know how to change single config value programmatically, by this way
$configData = [
'section' => 'MY_SECTION',
'website' => null,
'store' => null,
'groups' => [
'MY_GROUP' => [
'fields' => [
'MY_FIELD' => [
'value' => $myValue,
],
],
],
],
];
// $this->configFactory --> \Magento\Config\Model\Config\Factory
/** @var \Magento\Config\Model\Config $configModel */
$configModel = $this->configFactory->create(['data' => $configData]);
$configModel->save();
But now I want to know, can we set multiple config field values by this way or any other way ?
Best Answer
We can use the Magento Database Adapter to insert or update the data.
I follow the same logic of checkout module -
vendor/magento/module-checkout/Setup/InstallData.php
.[EDIT]
We also try with
Magento\Config\Model\Config::setDataByPath()
method.