public static function ResourceIdentifier::toResourceIdentifiersWithArityRequired in Drupal 8
Same name and namespace in other branches
- 9 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 362
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));
}