public static function ResourceIdentifier::toResourceIdentifiersWithArityRequired in JSON:API 8.2
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 src/
Controller/ EntityResource.php - Adds a relationship to a to-many relationship.
- EntityResource::removeFromRelationshipData in src/
Controller/ EntityResource.php - Deletes the relationship of an entity.
- EntityResource::replaceRelationshipData in src/
Controller/ EntityResource.php - Updates the relationship of an entity.
File
- src/
JsonApiResource/ ResourceIdentifier.php, line 359
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));
}