You are here

protected static function EntityResource::relationshipResponseRequiresBody in JSON:API 8.2

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 src/Controller/EntityResource.php
Adds a relationship to a to-many relationship.
EntityResource::replaceRelationshipData in src/Controller/EntityResource.php
Updates the relationship of an entity.

File

src/Controller/EntityResource.php, line 950

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',
  ]));
}