You are here

protected static function EntityResource::relationshipResponseRequiresBody in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::relationshipResponseRequiresBody()

Determines if the client needs to be updated with new relationship data.

Parameters

array $received_resource_identifiers: The array of resource identifiers given by the client.

array $final_resource_identifiers: The final array of resource identifiers after applying the requested changes.

Return value

bool Whether the final array of resource identifiers is different than the client-sent data.

2 calls to EntityResource::relationshipResponseRequiresBody()
EntityResource::addToRelationshipData in core/modules/jsonapi/src/Controller/EntityResource.php
Adds a relationship to a to-many relationship.
EntityResource::replaceRelationshipData in core/modules/jsonapi/src/Controller/EntityResource.php
Updates the relationship of an entity.

File

core/modules/jsonapi/src/Controller/EntityResource.php, line 970

Class

EntityResource
Process all entity requests.

Namespace

Drupal\jsonapi\Controller

Code

protected static function relationshipResponseRequiresBody(array $received_resource_identifiers, array $final_resource_identifiers) {
  return !empty(array_udiff($final_resource_identifiers, $received_resource_identifiers, [
    ResourceIdentifier::class,
    'compare',
  ]));
}