function EntityResource::relationshipResponseRequiresBody

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::relationshipResponseRequiresBody()
  2. 10 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::relationshipResponseRequiresBody()
  3. 11.x 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 988

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.