process_config_data.php 607 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. use Magento\Config\Model\Config;
  8. use Magento\Framework\App\Config\Storage\WriterInterface;
  9. $processConfigData = function (Config $config, array $data) {
  10. foreach ($data as $key => $value) {
  11. $config->setDataByPath($key, $value);
  12. $config->save();
  13. }
  14. };
  15. $deleteConfigData = function (WriterInterface $writer, array $configData, string $scope, int $scopeId) {
  16. foreach ($configData as $path) {
  17. $writer->delete($path, $scope, $scopeId);
  18. }
  19. };