| @@ 130-147 (lines=18) @@ | ||
| 127 | /** |
|
| 128 | * @inheritdoc |
|
| 129 | */ |
|
| 130 | public static function update( |
|
| 131 | array $routeParams, |
|
| 132 | ContainerInterface $container, |
|
| 133 | ServerRequestInterface $request |
|
| 134 | ): ResponseInterface { |
|
| 135 | list ($updated, $index, $api) = static::updateImpl($routeParams, $container, $request); |
|
| 136 | ||
| 137 | $responses = static::createResponses($container, $request); |
|
| 138 | if ($updated > 0) { |
|
| 139 | $modelData = $api->read($index); |
|
| 140 | assert(!($modelData instanceof PaginatedDataInterface)); |
|
| 141 | $response = $responses->getContentResponse($modelData); |
|
| 142 | } else { |
|
| 143 | $response = $responses->getCodeResponse(404); |
|
| 144 | } |
|
| 145 | ||
| 146 | return $response; |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * @inheritdoc |
|
| @@ 344-375 (lines=32) @@ | ||
| 341 | * |
|
| 342 | * @return ResponseInterface |
|
| 343 | */ |
|
| 344 | protected static function updateInRelationship( |
|
| 345 | $parentIndex, |
|
| 346 | string $relationshipName, |
|
| 347 | $childIndex, |
|
| 348 | array $attributes, |
|
| 349 | array $toMany, |
|
| 350 | string $childApiClass, |
|
| 351 | ContainerInterface $container, |
|
| 352 | ServerRequestInterface $request |
|
| 353 | ): ResponseInterface { |
|
| 354 | /** @var CrudInterface $childApi */ |
|
| 355 | list ($updated, $childApi) = static::updateInRelationshipImpl( |
|
| 356 | $parentIndex, |
|
| 357 | $relationshipName, |
|
| 358 | $childIndex, |
|
| 359 | $attributes, |
|
| 360 | $toMany, |
|
| 361 | $childApiClass, |
|
| 362 | $container |
|
| 363 | ); |
|
| 364 | ||
| 365 | $responses = static::createResponses($container, $request); |
|
| 366 | if ($updated > 0) { |
|
| 367 | $modelData = $childApi->read($childIndex); |
|
| 368 | assert(!($modelData instanceof PaginatedDataInterface)); |
|
| 369 | $response = $responses->getContentResponse($modelData); |
|
| 370 | } else { |
|
| 371 | $response = $responses->getCodeResponse(404); |
|
| 372 | } |
|
| 373 | ||
| 374 | return $response; |
|
| 375 | } |
|
| 376 | ||
| 377 | /** |
|
| 378 | * @param ContainerInterface $container |
|