Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 1.74 KB

01-trait.md

File metadata and controls

17 lines (12 loc) · 1.74 KB

back to README

Dogado\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 = null, array $attributes = []) 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