add file count to project task
This commit is contained in:
parent
2337bd75a1
commit
5cfd591140
@ -52,7 +52,7 @@ class ProjectTask extends ActiveRecord
|
|||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public static function priorityList() :array
|
public static function priorityList(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
self::PRIORITY_LOW => 'Низкий',
|
self::PRIORITY_LOW => 'Низкий',
|
||||||
@ -182,6 +182,9 @@ class ProjectTask extends ActiveRecord
|
|||||||
'comment_count' => function () {
|
'comment_count' => function () {
|
||||||
return $this->getCommentCount();
|
return $this->getCommentCount();
|
||||||
},
|
},
|
||||||
|
'file_count' => function () {
|
||||||
|
return $this->getFileCount();
|
||||||
|
},
|
||||||
'taskUsers',
|
'taskUsers',
|
||||||
'mark',
|
'mark',
|
||||||
'execution_priority'
|
'execution_priority'
|
||||||
@ -196,6 +199,14 @@ class ProjectTask extends ActiveRecord
|
|||||||
return Comment::find()->where(['entity_id' => $this->id, 'entity_type' => 2, 'status' => Comment::STATUS_ACTIVE])->count();
|
return Comment::find()->where(['entity_id' => $this->id, 'entity_type' => 2, 'status' => Comment::STATUS_ACTIVE])->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool|int|string|null
|
||||||
|
*/
|
||||||
|
public function getFileCount()
|
||||||
|
{
|
||||||
|
return FileEntity::find()->where(['entity_id' => $this->id, 'entity_type' => 2, 'status' => FileEntity::STATUS_ACTIVE])->count();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
@ -244,7 +255,7 @@ class ProjectTask extends ActiveRecord
|
|||||||
*/
|
*/
|
||||||
public function getCompany(): ActiveQuery
|
public function getCompany(): ActiveQuery
|
||||||
{
|
{
|
||||||
return $this->hasOne(Company::class,['id' => 'company_id'])
|
return $this->hasOne(Company::class, ['id' => 'company_id'])
|
||||||
->via('project');
|
->via('project');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user