Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityResource.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal