* update data load * * @param int $dataloadId * @param $name * @param $option * @param $schedule * @return bool */
(int $dataloadId, $name, $option, $schedule, $storageMapping = null)
| 109 | * @return bool |
| 110 | */ |
| 111 | public function update(int $dataloadId, $name, $option, $schedule, $storageMapping = null) |
| 112 | { |
| 113 | $dataload = $this->DataloadMapper->readOwnById($dataloadId); |
| 114 | if (empty($dataload)) { |
| 115 | return false; |
| 116 | } |
| 117 | $option = $this->DatasourceController->encodeOptionsForStorage((int)$dataload['datasource'], $option); |
| 118 | |
| 119 | if (in_array($dataload['datasource'], [0, '0'], true)) { |
| 120 | $this->deletionFilter((int)$dataload['dataset'], $option); |
| 121 | } |
| 122 | |
| 123 | if (is_array($storageMapping)) { |
| 124 | $storageMapping = json_encode($storageMapping, JSON_THROW_ON_ERROR); |
| 125 | } |
| 126 | if ($storageMapping !== null && !is_array(json_decode((string)$storageMapping, true))) { |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | return $this->DataloadMapper->update($dataloadId, $name, $option, $schedule, $storageMapping); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * copy a data load |
no test coverage detected