guild/frontend/modules/api/models/resume/Resume.php

87 lines
1.9 KiB
PHP
Raw Normal View History

2023-11-07 15:42:15 +03:00
<?php
namespace frontend\modules\api\models\resume;
2023-11-08 12:06:22 +03:00
use frontend\modules\card\models\UserCard;
2023-11-07 15:42:15 +03:00
/**
*
* @OA\Schema(
* schema="Resume",
2023-11-08 12:06:22 +03:00
* type="array",
* @OA\Items(
* @OA\Property(
* property="fio",
* type="string",
* example="ФИО",
* description="ФИО"
* ),
* @OA\Property(
* property="position",
* type="string",
* example="position",
* description="Специализация"
* ),
2023-11-07 15:42:15 +03:00
* @OA\Property(
* property="stack",
* type="array",
* @OA\Items(
* type="string",
* ),
* example="[Yii2,Vue]",
* description="Основной стек"
* ),
* @OA\Property(
* property="resume",
* type="string",
* example="Резюме",
* description="Тело резюме в HTML разметке"
* ),
2023-11-08 12:06:22 +03:00
* @OA\Property(
* property="projects",
* ref="#/components/schemas/UserCardPortfolioProjectsExample",
* ),
* ),
2023-11-07 15:42:15 +03:00
*)
*
* @OA\Schema(
* schema="ResumeExample",
* type="array",
* @OA\Items(
* ref="#/components/schemas/Resume",
* ),
*)
2023-11-08 12:06:22 +03:00
* @property UserCard $userCard
2023-11-07 15:42:15 +03:00
*/
class Resume extends \common\models\User
{
/**
* @return string[]
*/
public function fields(): array
{
return [
2023-11-08 12:06:22 +03:00
'fio' => function () {
return $this->userCard->fio;
},
'position' => function () {
return $this->userCard->position->name;
},
'stack' => function () {
2023-11-07 15:42:15 +03:00
return $this->userCard->getSkillsName();
},
'resume' => function () {
return $this->userCard->vc_text;
},
2023-11-08 12:06:22 +03:00
'projects' => function () {
return $this->userCard->userCardPortfolioProjects;
},
2023-11-07 15:42:15 +03:00
];
}
2023-11-08 12:06:22 +03:00
public function getUserCard()
{
return $this->hasOne(UserCard::class, ['id_user' => 'id']);
}
2023-11-07 15:42:15 +03:00
}