[*] phpcmd и правка класса пользователя

This commit is contained in:
rsgrinko committed 2022-06-22 17:14:26 +03:00
1 parent 4600647a7a
commit 295eca8f8a
1 file changed
+18 -1
+18 -1
View File
@@ -50,7 +50,7 @@
if (empty($id)) {
throw new CoreException('Передан некорректный идентификатор пользователя', CoreException::ERROR_INCORRECT_USER_ID);
}
if (!(DB::getInstance())->getItem(self::USERS_TABLE, ['id' => $id])) {
if (!self::isUserExistsByParams(['id' => $id])) {
throw new CoreException('Пользователь с идентификатором ' . $id . ' отсутствует в базе', CoreException::ERROR_USER_NOT_FOUND);
}
@@ -234,6 +234,23 @@
}
}
/**
* Проверка пользователя на существование по параметрам
*
* @param array $where Массив параметров фильтра
*
* @return bool
*/
public static function isUserExistsByParams(array $where): bool
{
$result = (DB::getInstance())->getItem(self::USERS_TABLE, $where);
if (!empty($result)) {
return true;
} else {
return false;
}
}
/**
* Проверка пользователя на онлайн
*