Conditions | 5 |
Paths | 7 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
59 | public function reorder(?int $position = null, ?string $positionField = null) |
||
60 | { |
||
61 | $positionField ??= $this->getPositionBehavior()->getField(); |
||
62 | |||
63 | if ($this->fireEventCancel('beforeReorder') === false) { |
||
|
|||
64 | return false; |
||
65 | } |
||
66 | |||
67 | $this->assign([$positionField => $position], [$positionField]); |
||
68 | $saved = $this->save() && (!$this->hasSnapshotData() || $this->hasUpdated($positionField)); |
||
69 | |||
70 | if ($saved) { |
||
71 | $this->fireEvent('afterReorder'); |
||
72 | } |
||
73 | |||
74 | return $saved; |
||
75 | } |
||
77 |