Skip to content
Snippets Groups Projects

Issue #3377269: Warning: Undefined array key "id" in Drupal\jsonapi\Controller\EntityResource->patchIndividual()

Closed Issue #3377269: Warning: Undefined array key "id" in Drupal\jsonapi\Controller\EntityResource->patchIndividual()
1 unresolved thread
1 unresolved thread
Files
2
@@ -315,11 +315,11 @@ public function patchIndividual(ResourceType $resource_type, EntityInterface $en
$body = Json::decode($request->getContent());
$data = $body['data'];
if ($data['id'] != $entity->uuid()) {
if (!isset($data['id']) || $data['id'] != $entity->uuid()) {
throw new BadRequestHttpException(sprintf(
'The selected entity (%s) does not match the ID in the payload (%s).',
$entity->uuid(),
$data['id']
$data['id'] ?? '',
));
}
$data += ['attributes' => [], 'relationships' => []];
Loading