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