Conditions | 7 |
Paths | 15 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function onSave(/** @scrutinizer ignore-unused */Mapper $mapper, ActionInterface $action) |
||
35 | { |
||
36 | if ($action instanceof Insert) { |
||
37 | if ($this->createColumn) { |
||
38 | $action->addColumns([$this->createColumn => time()]); |
||
39 | } |
||
40 | if ($this->updateColumn) { |
||
41 | $action->addColumns([$this->updateColumn => time()]); |
||
42 | } |
||
43 | } |
||
44 | if ($action instanceof Update && $this->updateColumn) { |
||
45 | if (! empty($action->getEntity()->getChanges())) { |
||
46 | $action->addColumns([$this->updateColumn => time()]); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | return $action; |
||
51 | } |
||
53 |