| Total Complexity | 4 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class SoftDelete extends Delete |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var int |
||
| 12 | */ |
||
| 13 | protected $now; |
||
| 14 | |||
| 15 | protected function execute() |
||
| 16 | { |
||
| 17 | $entityId = $this->mapper->getEntityPk($this->entity); |
||
| 18 | if (! $entityId) { |
||
| 19 | return; |
||
| 20 | } |
||
| 21 | |||
| 22 | $this->now = time(); |
||
| 23 | |||
| 24 | $update = new \Sirius\Sql\Update($this->mapper->getWriteConnection()); |
||
| 25 | $update->table($this->mapper->getTable()) |
||
| 26 | ->columns([ |
||
| 27 | $this->getOption('deleted_at_column') => $this->now |
||
| 28 | ]) |
||
| 29 | ->where('id', $entityId); |
||
| 30 | $update->perform(); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function onSuccess() |
||
| 38 | } |
||
| 39 | } |
||
| 41 |