Conditions | 1 |
Paths | 1 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function queueDelete($entity, Node $node, State $state): CommandInterface |
||
22 | { |
||
23 | // identify entity as being "deleted" |
||
24 | $state->setStatus(Node::SCHEDULED_DELETE); |
||
25 | $state->decClaim(); |
||
26 | |||
27 | $cmd = new Update( |
||
28 | $this->source->getDatabase(), |
||
29 | $this->source->getTable(), |
||
30 | ['deleted_at' => new \DateTimeImmutable()] |
||
31 | ); |
||
32 | |||
33 | // forward primaryKey value from entity state |
||
34 | // this sequence is only required if the entity is created and deleted |
||
35 | // within one transaction |
||
36 | $cmd->waitScope($this->primaryColumn); |
||
37 | $state->forward( |
||
38 | $this->primaryKey, |
||
39 | $cmd, |
||
40 | $this->primaryColumn, |
||
41 | true, |
||
42 | ConsumerInterface::SCOPE |
||
43 | ); |
||
44 | |||
45 | return $cmd; |
||
46 | } |
||
48 |