1 | <?php |
||
2 | |||
3 | namespace Jabe\Impl\Cmd; |
||
4 | |||
5 | use Jabe\Impl\Interceptor\{ |
||
6 | CommandInterface, |
||
7 | CommandContext |
||
8 | }; |
||
9 | |||
10 | class DeleteProcessInstancesCmd extends AbstractDeleteProcessInstanceCmd implements CommandInterface, \Serializable |
||
11 | { |
||
12 | protected $processInstanceIds = []; |
||
13 | |||
14 | public function __construct( |
||
15 | array $processInstanceIds, |
||
16 | string $deleteReason, |
||
17 | bool $skipCustomListeners, |
||
18 | bool $externallyTerminated, |
||
19 | bool $skipSubprocesses, |
||
20 | bool $failIfNotExists |
||
21 | ) { |
||
22 | $this->processInstanceIds = $processInstanceIds; |
||
23 | $this->deleteReason = $deleteReason; |
||
24 | $this->skipCustomListeners = $skipCustomListeners; |
||
25 | $this->externallyTerminated = $externallyTerminated; |
||
26 | $this->skipSubprocesses = $skipSubprocesses; |
||
27 | $this->failIfNotExists = $failIfNotExists; |
||
28 | } |
||
29 | |||
30 | public function serialize() |
||
31 | { |
||
32 | return json_encode([ |
||
33 | 'processInstanceIds' => $this->processInstanceIds, |
||
34 | 'deleteReason' => $this->deleteReason, |
||
35 | 'skipCustomListeners' => $this->skipCustomListeners, |
||
36 | 'externallyTerminated' => $this->externallyTerminated, |
||
37 | 'skipSubprocesses' => $this->skipSubprocesses, |
||
38 | 'failIfNotExists' => $this->failIfNotExists |
||
39 | ]); |
||
40 | } |
||
41 | |||
42 | public function unserialize($data) |
||
43 | { |
||
44 | $json = json_decode($data); |
||
45 | $this->processInstanceIds = $json->processInstanceIds; |
||
46 | $this->deleteReason = $json->deleteReason; |
||
47 | $this->skipCustomListeners = $json->skipCustomListeners; |
||
48 | $this->externallyTerminated = $json->externallyTerminated; |
||
49 | $this->skipSubprocesses = $json->skipSubprocesses; |
||
50 | $this->failIfNotExists = $json->failIfNotExists; |
||
51 | } |
||
52 | |||
53 | public function execute(CommandContext $commandContext) |
||
54 | { |
||
55 | foreach ($this->processInstanceIds as $processInstanceId) { |
||
56 | $this->deleteProcessInstance($commandContext, $this->processInstanceId, $this->deleteReason, $this->skipCustomListeners, $this->externallyTerminated, false, $this->skipSubprocesses); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
57 | } |
||
58 | return null; |
||
59 | } |
||
60 | } |
||
61 |