forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompleteActivity.php
More file actions
46 lines (40 loc) · 1.29 KB
/
CompleteActivity.php
File metadata and controls
46 lines (40 loc) · 1.29 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
40
41
42
43
44
45
46
<?php
namespace ProcessMaker\Jobs;
use Illuminate\Contracts\Queue\ShouldQueue;
use ProcessMaker\Models\Process as Definitions;
use ProcessMaker\Nayra\Contracts\Bpmn\ActivityInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\TokenInterface;
use ProcessMaker\Nayra\Contracts\Engine\ExecutionInstanceInterface;
class CompleteActivity extends BpmnAction implements ShouldQueue
{
public $definitionsId;
public $instanceId;
public $tokenId;
public $data;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Definitions $definitions, ExecutionInstanceInterface $instance, TokenInterface $token, array $data)
{
$this->definitionsId = $definitions->getKey();
$this->instanceId = $instance->getKey();
$this->tokenId = $token->getKey();
$this->data = $data;
}
/**
* Execute the job.
*
* @return void
*/
public function action(TokenInterface $token, ActivityInterface $element, array $data)
{
$dataStore = $token->getInstance()->getDataStore();
//@todo requires a class to manage the data access and control the updates
foreach ($data as $key => $value) {
$dataStore->putData($key, $value);
}
$element->complete($token);
}
}