|
@@ 340-359 (lines=20) @@
|
| 337 |
|
* |
| 338 |
|
* @return ResponseInterface |
| 339 |
|
*/ |
| 340 |
|
protected static function deleteInRelationship( |
| 341 |
|
$parentIndex, |
| 342 |
|
string $relationshipName, |
| 343 |
|
$childIndex, |
| 344 |
|
string $childApiClass, |
| 345 |
|
ContainerInterface $container, |
| 346 |
|
ServerRequestInterface $request |
| 347 |
|
): ResponseInterface { |
| 348 |
|
/** @var SchemaInterface $schemaClass */ |
| 349 |
|
$schemaClass = static::SCHEMA_CLASS; |
| 350 |
|
$modelRelName = $schemaClass::getRelationshipMapping($relationshipName); |
| 351 |
|
$hasChild = self::createApi($container)->hasInRelationship($parentIndex, $modelRelName, $childIndex); |
| 352 |
|
if ($hasChild === false) { |
| 353 |
|
return static::createResponses($container, $request)->getCodeResponse(404); |
| 354 |
|
} |
| 355 |
|
|
| 356 |
|
$childApi = self::createApi($container, $childApiClass); |
| 357 |
|
|
| 358 |
|
return static::deleteImpl($childIndex, $container, $request, $childApi); |
| 359 |
|
} |
| 360 |
|
|
| 361 |
|
/** @noinspection PhpTooManyParametersInspection |
| 362 |
|
* @param int|string $parentIndex |
|
@@ 373-394 (lines=22) @@
|
| 370 |
|
* |
| 371 |
|
* @return ResponseInterface |
| 372 |
|
*/ |
| 373 |
|
protected static function updateInRelationship( |
| 374 |
|
$parentIndex, |
| 375 |
|
string $relationshipName, |
| 376 |
|
$childIndex, |
| 377 |
|
array $attributes, |
| 378 |
|
array $toMany, |
| 379 |
|
string $childApiClass, |
| 380 |
|
ContainerInterface $container, |
| 381 |
|
ServerRequestInterface $request |
| 382 |
|
): ResponseInterface { |
| 383 |
|
/** @var SchemaInterface $schemaClass */ |
| 384 |
|
$schemaClass = static::SCHEMA_CLASS; |
| 385 |
|
$modelRelName = $schemaClass::getRelationshipMapping($relationshipName); |
| 386 |
|
$hasChild = self::createApi($container)->hasInRelationship($parentIndex, $modelRelName, $childIndex); |
| 387 |
|
if ($hasChild === false) { |
| 388 |
|
return static::createResponses($container, $request)->getCodeResponse(404); |
| 389 |
|
} |
| 390 |
|
|
| 391 |
|
$childApi = self::createApi($container, $childApiClass); |
| 392 |
|
|
| 393 |
|
return static::updateImpl($childIndex, $attributes, $toMany, $container, $request, $childApi); |
| 394 |
|
} |
| 395 |
|
|
| 396 |
|
/** |
| 397 |
|
* @param ContainerInterface $container |