| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | $this->table = 'scenario_history_line'; |
| 15 | 15 | $this->pkey = 'id'; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function save($element) | |
| 18 | + public function save(object $element): ?int | |
| 19 | 19 | { |
| 20 | 20 | if (isset($element->params) && is_array($element->params)) { |
| 21 | 21 | $element->params = json_encode($element->params); |
| 22 | 22 | } |
| @@ -23,17 +23,8 @@ | ||
| 23 | 23 | |
| 24 | 24 | return parent::save($element); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - private function formatHistoryLine($historyLine) | |
| 28 | - { | |
| 29 | - if (!empty($historyLine->params)) { | |
| 30 | - $historyLine->params = json_decode($historyLine->params); | |
| 31 | - } | |
| 32 | - | |
| 33 | - return $historyLine; | |
| 34 | - } | |
| 35 | - | |
| 36 | 27 | public function getAllByProcessId(int $processId): array |
| 37 | 28 | { |
| 38 | 29 | return array_map([$this, 'formatHistoryLine'], acym_loadObjectList('SELECT * FROM #__acym_scenario_history_line WHERE scenario_process_id = '.$processId, 'id')); |
| 39 | 30 | } |
| @@ -84,6 +75,15 @@ | ||
| 84 | 75 | $results['elements'] = acym_loadObjectList($query, 'id', $settings['offset'], $settings['elementsPerPage']); |
| 85 | 76 | $results['total'] = acym_loadObject($queryCount); |
| 86 | 77 | |
| 87 | 78 | return $results; |
| 79 | + } | |
| 80 | + | |
| 81 | + private function formatHistoryLine(object $historyLine): object | |
| 82 | + { | |
| 83 | + if (!empty($historyLine->params)) { | |
| 84 | + $historyLine->params = json_decode($historyLine->params); | |
| 85 | + } | |
| 86 | + | |
| 87 | + return $historyLine; | |
| 88 | 88 | } |
| 89 | 89 | } |