| 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 |
||
| 24 | public function queueDelete($entity, Node $node, State $state): CommandInterface |
||
| 25 | { |
||
| 26 | // identify entity as being "deleted" |
||
| 27 | $state->setStatus(Node::SCHEDULED_DELETE); |
||
| 28 | $state->decClaim(); |
||
| 29 | |||
| 30 | $command = new Update( |
||
| 31 | $this->source->getDatabase(), |
||
| 32 | $this->source->getTable(), |
||
| 33 | ['deleted_at' => new \DateTimeImmutable()] |
||
| 34 | ); |
||
| 35 | |||
| 36 | // forward primaryKey value from entity state |
||
| 37 | // this sequence is only required if the entity is created and deleted |
||
| 38 | // within one transaction |
||
| 39 | $command->waitScope($this->primaryColumn); |
||
| 40 | $state->forward( |
||
| 41 | $this->primaryKey, |
||
| 42 | $command, |
||
| 43 | $this->primaryColumn, |
||
| 44 | true, |
||
| 45 | ConsumerInterface::SCOPE |
||
| 46 | ); |
||
| 47 | |||
| 48 | return $command; |
||
| 49 | } |
||
| 51 |