| @@ 258-274 (lines=17) @@ | ||
| 255 | * @throws ODataException |
|
| 256 | * @return array|mixed |
|
| 257 | */ |
|
| 258 | protected function createUpdateDeleteProcessOutput(JsonResponse $result) |
|
| 259 | { |
|
| 260 | $outData = $result->getData(); |
|
| 261 | if (is_object($outData)) { |
|
| 262 | $outData = (array) $outData; |
|
| 263 | } |
|
| 264 | ||
| 265 | if (!is_array($outData)) { |
|
| 266 | throw ODataException::createInternalServerError('Controller response does not have an array.'); |
|
| 267 | } |
|
| 268 | if (!(key_exists('id', $outData) && key_exists('status', $outData) && key_exists('errors', $outData))) { |
|
| 269 | throw ODataException::createInternalServerError( |
|
| 270 | 'Controller response array missing at least one of id, status and/or errors fields.' |
|
| 271 | ); |
|
| 272 | } |
|
| 273 | return $outData; |
|
| 274 | } |
|
| 275 | } |
|
| 276 | ||
| @@ 508-527 (lines=20) @@ | ||
| 505 | * @throws ODataException |
|
| 506 | * @return array|mixed |
|
| 507 | */ |
|
| 508 | private function createUpdateDeleteProcessOutput($result) |
|
| 509 | { |
|
| 510 | if (!($result instanceof \Illuminate\Http\JsonResponse)) { |
|
| 511 | throw ODataException::createInternalServerError('Controller response not well-formed json.'); |
|
| 512 | } |
|
| 513 | $outData = $result->getData(); |
|
| 514 | if (is_object($outData)) { |
|
| 515 | $outData = (array) $outData; |
|
| 516 | } |
|
| 517 | ||
| 518 | if (!is_array($outData)) { |
|
| 519 | throw ODataException::createInternalServerError('Controller response does not have an array.'); |
|
| 520 | } |
|
| 521 | if (!(key_exists('id', $outData) && key_exists('status', $outData) && key_exists('errors', $outData))) { |
|
| 522 | throw ODataException::createInternalServerError( |
|
| 523 | 'Controller response array missing at least one of id, status and/or errors fields.' |
|
| 524 | ); |
|
| 525 | } |
|
| 526 | return $outData; |
|
| 527 | } |
|
| 528 | ||
| 529 | /** |
|
| 530 | * @param $sourceEntityInstance |
|