function ResourceIdentifier::toResourceIdentifiersWithArityRequired
Same name in other branches
- 9 core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::toResourceIdentifiersWithArityRequired()
- 8.9.x core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::toResourceIdentifiersWithArityRequired()
- 11.x core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\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\JsonApiResourceCode
public static function toResourceIdentifiersWithArityRequired(EntityReferenceFieldItemListInterface $items) {
return array_map(function (ResourceIdentifier $identifier) {
return $identifier->hasArity() ? $identifier : $identifier->withArity(0);
}, static::toResourceIdentifiers($items));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.