added get-points-number, get-question-number methods, update status in UserQuestionnaire, some refactoring

This commit is contained in:
iironside
2022-03-17 14:50:57 +03:00
parent 120cf406c3
commit 55089accb5
14 changed files with 895 additions and 15 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace common\services;
use common\models\UserCard;
use yii\web\ServerErrorHttpException;
class UserCardService
{
/**
* @throws ServerErrorHttpException
*/
public static function getUserCard($user_id): array
{
$userCard = UserCard::findOne(['id_user' => $user_id]);
if (empty($userCard)) {
throw new ServerErrorHttpException(json_encode($userCard->errors));
}
return array('fio' => $userCard->fio,
'photo' => $userCard->photo,
'gender' => $userCard->gender,
'level' => $userCard->level,
'years_of_exp' => $userCard->years_of_exp,
'specification' => $userCard->specification,
'position_name' => $userCard->position->name);
}
}