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

Breadcrumb

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

function ResourceIdentifier::toResourceIdentifiersWithArityRequired

Creates an array of ResourceIdentifier objects with arity on every value.

Parameters

\Drupal\Core\Field\EntityReferenceFieldItemListInterface $items: The entity reference field items from which to create the relationship array.

Return value

self[] An array of new ResourceIdentifier objects with appropriate arity values. Unlike self::toResourceIdentifiers(), this method does not omit arity when an identifier is not parallel to any other identifier.

3 calls to ResourceIdentifier::toResourceIdentifiersWithArityRequired()
EntityResource::addToRelationshipData in core/modules/jsonapi/src/Controller/EntityResource.php
Adds a relationship to a to-many relationship.
EntityResource::removeFromRelationshipData in core/modules/jsonapi/src/Controller/EntityResource.php
Deletes the relationship of an entity.
EntityResource::replaceRelationshipData in core/modules/jsonapi/src/Controller/EntityResource.php
Updates the relationship of an entity.

File

core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php, line 364

Class

ResourceIdentifier
Represents a JSON:API resource identifier object.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public static function toResourceIdentifiersWithArityRequired(EntityReferenceFieldItemListInterface $items) {
    return array_map(function (ResourceIdentifier $identifier) {
        return $identifier->hasArity() ? $identifier : $identifier->withArity(0);
    }, static::toResourceIdentifiers($items));
}

API Navigation

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