function () { return $this->owner; }, 'open_tasks_count'=> function () { return $this->getProjectTask()->where(['status' => ProjectTask::STATUS_ACTIVE])->count(); }, 'task_on_work_count'=> function () { return $this->getProjectTask()->where(['status' => ProjectTask::STATUS_AT_WORK])->count(); }, 'closed_task_count'=> function () { return $this->getProjectTask()->where(['status' => ProjectTask::STATUS_ARCHIVE])->count(); }, 'participants'=> function () { return $this->participants; }, ]; } /** * @return string[] */ public function extraFields(): array { return []; } /** * @return ActiveQuery */ public function getOwner() { return $this->hasOne(ProjectParticipants::class, ['id' => 'owner_id']); } /** * @return ActiveQuery */ public function getProjectUsers() { return $this->hasMany(ProjectUser::class, ['project_id' => 'id']); } public function getLinks(): array { return [ Link::REL_SELF => Url::to(['index', 'project_id' => $this->id], true), ]; } public function getCompany(): ActiveQuery { return $this->hasOne(Company::class, ['id' => 'company_id']); } public function getParticipants() { return $this->hasMany(ProjectParticipants::class, ['project_id' => 'id']); } }