back to README

Enm\JsonApi\JsonApiTrait

This trait offers some methods to help you with creation of needed objects in json api context.

Method Return type Description
resource(string $type, string $id) ResourceInterface Create a new JSON resource
singleResourceDocument(ResourceInterface $resource = null) DocumentInterface Create a document which can contain one resource
multiResourceDocument(array $resource = []) DocumentInterface Create a document which can contain multiple resources
toOneRelationship(string $name, ResourceInterface $related = null) RelationshipInterface Create a new to one relationship object
toManyRelationship(string $name, array $related = []) RelationshipInterface Create a new to many relationship object

back to README next: Resources