forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
25 lines
727 B
PHP
25 lines
727 B
PHP
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Install file for commerce_exchanger.
|
|
*/
|
|
|
|
use Drupal\commerce_exchanger\Entity\ExchangeRates;
|
|
|
|
/**
|
|
* Fix issues with wrongly set configuration rates schema.
|
|
*/
|
|
function commerce_exchanger_update_8001() {
|
|
// Load all existing and set properly new structure.
|
|
/** @var \Drupal\commerce_exchanger\Entity\ExchangeRatesInterface[] $exchange_rates */
|
|
if ($exchange_rates = ExchangeRates::loadMultiple()) {
|
|
foreach ($exchange_rates as $exchange_rate) {
|
|
$config_name = $exchange_rate->getExchangerConfigName();
|
|
$config_file = \Drupal::configFactory()->getEditable($config_name);
|
|
$config_file->setData(['rates' => $config_file->getRawData()]);
|
|
$config_file->save();
|
|
}
|
|
}
|
|
}
|