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