File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -31,19 +31,18 @@ A simple example to illustrate the general idea. This (slightly modified) JSON r
3131```
3232can be built with the following php code:
3333``` php
34+ $articles = new ResourceObject('articles', '1');
3435$author = Relationship::fromLinkage(
35- Linkage::fromSingleResourceId (
36- new ResourceId ('people', '9')
36+ Linkage::fromSingleIdentifier (
37+ new ResourceIdentifier ('people', '9')
3738 )
3839);
3940$author->setLink('self', '/articles/1/relationships/author');
4041$author->setLink('related', '/articles/1/author');
41-
42- $articles = new ResourceObject('articles', '1');
4342$articles->setRelationship('author', $author);
4443$articles->setAttribute('title', 'Rails is Omakase');
45-
46- echo json_encode(Document::fromData($articles) , JSON_PRETTY_PRINT);
44+ $doc = Document::fromResource($articles);
45+ echo json_encode($doc , JSON_PRETTY_PRINT);
4746```
4847
4948Please refer to [ the tests] ( ./test ) for the full API documentation:
You can’t perform that action at this time.
0 commit comments