2023-01-24 17:32:46 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace frontend\modules\api\models;
|
|
|
|
|
|
|
|
use yii\db\ActiveQuery;
|
|
|
|
use yii\helpers\Url;
|
|
|
|
use yii\web\Link;
|
|
|
|
use yii\web\Linkable;
|
|
|
|
|
2023-04-19 01:22:57 +03:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @OA\Schema(
|
|
|
|
* schema="Project",
|
|
|
|
* @OA\Property(
|
|
|
|
* property="id",
|
|
|
|
* type="int",
|
2023-04-25 01:32:15 +03:00
|
|
|
* example=95,
|
2023-04-19 01:22:57 +03:00
|
|
|
* description="Идентификатор проекта"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
|
|
|
* property="name",
|
|
|
|
* type="string",
|
|
|
|
* example="PHP",
|
|
|
|
* description="Название проекта"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
|
|
|
* property="status",
|
|
|
|
* type="int",
|
|
|
|
* example="10",
|
|
|
|
* description="Статус проекта"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
|
|
|
* property="hh_id",
|
|
|
|
* type="int",
|
|
|
|
* example="234",
|
|
|
|
* description="Идентификатор проекта на hh.ru"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
2023-04-20 02:07:19 +03:00
|
|
|
* property="owner_id",
|
|
|
|
* type="int",
|
|
|
|
* example="19",
|
|
|
|
* description="Идентификатор владельца проекта"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
2023-04-19 01:22:57 +03:00
|
|
|
* property="company",
|
|
|
|
* ref="#/components/schemas/Company",
|
|
|
|
* ),
|
2023-04-25 01:32:15 +03:00
|
|
|
* @OA\Property(
|
|
|
|
* property="columns",
|
|
|
|
* ref="#/components/schemas/ProjectColumnExample",
|
|
|
|
* ),
|
2023-04-19 01:22:57 +03:00
|
|
|
*)
|
|
|
|
*
|
|
|
|
* @OA\Schema(
|
|
|
|
* schema="ProjectExample",
|
|
|
|
* type="array",
|
|
|
|
* @OA\Items(
|
|
|
|
* type="object",
|
|
|
|
* @OA\Property(
|
|
|
|
* property="id",
|
|
|
|
* type="integer",
|
|
|
|
* example="1"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
|
|
|
* property="name",
|
|
|
|
* type="string",
|
|
|
|
* example="OhDesign - backend"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
|
|
|
* property="status",
|
|
|
|
* type="integer",
|
|
|
|
* example="10"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
|
|
|
* property="hh_id",
|
|
|
|
* type="integer",
|
|
|
|
* example="345343434"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
2023-04-20 02:07:19 +03:00
|
|
|
* property="owner_id",
|
|
|
|
* type="integer",
|
|
|
|
* example="19"
|
|
|
|
* ),
|
|
|
|
* @OA\Property(
|
2023-04-19 01:22:57 +03:00
|
|
|
* property="company",
|
|
|
|
* ref="#/components/schemas/Company",
|
|
|
|
* ),
|
|
|
|
* ),
|
|
|
|
*)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class Project extends \common\models\Project
|
2023-01-24 17:32:46 +03:00
|
|
|
{
|
|
|
|
public function fields(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id',
|
|
|
|
'name',
|
2023-04-19 01:22:57 +03:00
|
|
|
//'budget',
|
2023-01-24 17:32:46 +03:00
|
|
|
'status',
|
|
|
|
'hh_id' => function() {
|
|
|
|
return $this->hh;
|
|
|
|
},
|
2023-04-20 02:07:19 +03:00
|
|
|
'owner_id',
|
2023-01-24 17:32:46 +03:00
|
|
|
'company' => function() {
|
|
|
|
return $this->company;
|
2023-04-25 01:32:15 +03:00
|
|
|
},
|
|
|
|
|
2023-01-24 17:32:46 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function extraFields(): array
|
|
|
|
{
|
2023-04-25 01:32:15 +03:00
|
|
|
return ['columns',];
|
2023-01-24 17:32:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getLinks(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
Link::REL_SELF => Url::to(['index', 'project_id' => $this->id], true),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCompany(): ActiveQuery
|
|
|
|
{
|
|
|
|
return $this->hasOne(Company::className(), ['id' => 'company_id']);
|
|
|
|
}
|
|
|
|
}
|