| @@ -173,14 +173,14 @@ | ||
| 173 | 173 | * Creates or updates the specified record. |
| 174 | 174 | * |
| 175 | 175 | * @param object &$data The record to insert. |
| 176 | 176 | * |
| 177 | - * @return boolean True if the record has been inserted/updated, otherwise false. | |
| 177 | + * @return mixed The ID of the inserted record on success, false otherwise. | |
| 178 | 178 | */ |
| 179 | 179 | public function save(&$data) |
| 180 | 180 | { |
| 181 | 181 | // get old item to get previous shortcode |
| 182 | - $old = $this->getItem($data->id); | |
| 182 | + $old = ($data->id ?? 0) ? $this->getItem($data->id) : null; | |
| 183 | 183 | |
| 184 | 184 | // save shortcode |
| 185 | 185 | $res = parent::save($data); |
| 186 | 186 | |