| @@ -180,9 +180,9 @@ | ||
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | foreach ($this->jsonColumns as $oneColumn) { |
| 184 | - if (!isset($element->$oneColumn)) { | |
| 184 | + if (!property_exists($element, $oneColumn)) { | |
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if (empty($element->$oneColumn)) { |
| @@ -187,9 +187,10 @@ | ||
| 187 | 187 | |
| 188 | 188 | if (empty($element->$oneColumn)) { |
| 189 | 189 | $element->$oneColumn = []; |
| 190 | 190 | } elseif (is_string($element->$oneColumn)) { |
| 191 | - $element->$oneColumn = json_decode($element->$oneColumn, true); | |
| 191 | + $decodedColumn = json_decode($element->$oneColumn, true); | |
| 192 | + $element->$oneColumn = is_array($decodedColumn) ? $decodedColumn : []; | |
| 192 | 193 | } |
| 193 | 194 | } |
| 194 | 195 | } |
| 195 | 196 | } |