forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessManagerAssigned.php
More file actions
39 lines (35 loc) · 1.23 KB
/
Copy pathProcessManagerAssigned.php
File metadata and controls
39 lines (35 loc) · 1.23 KB
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
<?php
namespace ProcessMaker\AssignmentRules;
use ProcessMaker\Contracts\AssignmentRuleInterface;
use ProcessMaker\Exception\ThereIsNoProcessManagerAssignedException;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Nayra\Contracts\Bpmn\ActivityInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\TokenInterface;
/**
* The task is assigned to the Manager of the Process.
*/
class ProcessManagerAssigned implements AssignmentRuleInterface
{
/**
* The task is assigned to the Manager of the Process.
*
* It takes in count the process version of the request.
* If the process does not have assigned a Manager, it throws an exception.
*
* @param ActivityInterface $task
* @param TokenInterface $token
* @param Process $process
* @param ProcessRequest $request
* @return int
* @throws ThereIsNoProcessManagerAssignedException
*/
public function getNextUser(ActivityInterface $task, TokenInterface $token, Process $process, ProcessRequest $request)
{
$user_id = $request->processVersion->manager_id;
if (!$user_id) {
throw new ThereIsNoProcessManagerAssignedException($task);
}
return $user_id;
}
}