mapguesser/database/migrations/data/20230923_1905_username.php

14 lines
380 B
PHP

<?php
use Faker\Factory;
use MapGuesser\PersistentData\Model\User;
use SokoWeb\Database\Query\Select;
$select = new Select(Container::$dbConnection);
$users = Container::$persistentDataManager->selectMultipleFromDb($select, User::class);
foreach ($users as $user) {
$user->setUsername(Factory::create()->userName);
Container::$persistentDataManager->saveToDb($user);
}