/
WorkflowService.php
41 lines (34 loc) · 1.02 KB
/
WorkflowService.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace contrib\workflow;
use contrib\workflow\models\Flow;
use contrib\workflow\models\FlowDefinition;
use contrib\workflow\models\Process;
use contrib\workflow\models\Task;
use yii\web\NotFoundHttpException;
class WorkflowService
{
public static function createFlow($flowId)
{
return Flow::createFlow($flowId);
}
public static function getTaskOfUser($userId)
{
return Flow::getTaskOfUserQuery($userId)->orderBy('created_at')->all();
}
public static function getTaskOfProcess($processId)
{
return Task::find()->with('assigneeUser')->where(['process_id' => $processId])->orderBy('id')->all();
}
public static function getProcesses()
{
return Process::find()
->with('flowDefinition')
->andWhere(['status' => Constant::STATUS_ACTIVE])
->orderBy('id')
->all();
}
public static function getFlows()
{
return FlowDefinition::find()->all();
}
}