20 lines
659 B
PHP
20 lines
659 B
PHP
|
<?php
|
||
|
|
||
|
use RVR\PersistentData\Model\Community;
|
||
|
use RVR\PersistentData\Model\Currency;
|
||
|
use SokoWeb\Database\Query\Select;
|
||
|
|
||
|
$select = new Select(Container::$dbConnection);
|
||
|
$communities = Container::$persistentDataManager->selectMultipleFromDb($select, Community::class);
|
||
|
|
||
|
foreach ($communities as $community) {
|
||
|
$mainCurrency = new Currency();
|
||
|
$mainCurrency->setCommunity($community);
|
||
|
$mainCurrency->setCode($community->getCurrency());
|
||
|
$mainCurrency->setRoundDigits(0);
|
||
|
Container::$persistentDataManager->saveToDb($mainCurrency);
|
||
|
|
||
|
$community->setMainCurrency($mainCurrency);
|
||
|
Container::$persistentDataManager->saveToDb($community);
|
||
|
}
|