Add marks to project and task request responses

This commit is contained in:
iIronside
2023-10-12 11:34:47 +03:00
parent f9e22f2d2e
commit 16309e5e4f
7 changed files with 111 additions and 71 deletions

View File

@ -24,6 +24,8 @@ use yii\helpers\ArrayHelper;
* @property FieldsValue[] $fieldsValues
* @property Company $company
* @property ProjectUser[] $projectUsers
* @property Mark[] $mark
* @property MarkEntity[] $markEntity
*/
class Project extends \yii\db\ActiveRecord
{
@ -135,6 +137,24 @@ class Project extends \yii\db\ActiveRecord
return $this->hasMany(ProjectUser::class, ['project_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getMark()
{
return $this->hasMany(Mark::class, ['id' => 'mark_id'])
->via('markEntity');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getMarkEntity()
{
return $this->hasMany(MarkEntity::class, ['entity_id' => 'id'])
->where(['entity_type' => Entity::ENTITY_TYPE_PROJECT]);
}
/**
* @return array
*/