|
7 | 7 | use JsonApiPhp\JsonApi\Link\NextLink; |
8 | 8 | use JsonApiPhp\JsonApi\Link\RelatedLink; |
9 | 9 | use JsonApiPhp\JsonApi\Link\SelfLink; |
10 | | -use JsonApiPhp\JsonApi\PaginatedResourceCollection; |
| 10 | +use JsonApiPhp\JsonApi\PaginatedCollection; |
11 | 11 | use JsonApiPhp\JsonApi\Pagination; |
| 12 | +use JsonApiPhp\JsonApi\ResourceCollection; |
12 | 13 | use JsonApiPhp\JsonApi\ResourceIdentifier; |
13 | 14 | use JsonApiPhp\JsonApi\ResourceIdentifierCollection; |
14 | 15 | use JsonApiPhp\JsonApi\ResourceObject; |
|
39 | 40 | '12', |
40 | 41 | new Attribute('body', 'I like XML better'), |
41 | 42 | new SelfLink('http://example.com/comments/12'), |
42 | | - new ToOne('author', $dan->toIdentifier()) |
| 43 | + new ToOne('author', $dan->identifier()) |
43 | 44 | ); |
44 | 45 |
|
45 | 46 | $document = new CompoundDocument( |
46 | | - new PaginatedResourceCollection( |
| 47 | + new PaginatedCollection( |
47 | 48 | new Pagination( |
48 | 49 | new NextLink('http://example.com/articles?page[offset]=2'), |
49 | 50 | new LastLink('http://example.com/articles?page[offset]=10') |
50 | 51 | ), |
51 | | - new ResourceObject( |
52 | | - 'articles', |
53 | | - '1', |
54 | | - new Attribute('title', 'JSON API paints my bikeshed!'), |
55 | | - new SelfLink('http://example.com/articles/1'), |
56 | | - new ToOne( |
57 | | - 'author', |
58 | | - $dan->toIdentifier(), |
59 | | - new SelfLink('http://example.com/articles/1/relationships/author'), |
60 | | - new RelatedLink('http://example.com/articles/1/author') |
61 | | - ), |
62 | | - new ToMany( |
63 | | - 'comments', |
64 | | - new ResourceIdentifierCollection( |
65 | | - $comment05->toIdentifier(), |
66 | | - $comment12->toIdentifier() |
| 52 | + new ResourceCollection( |
| 53 | + new ResourceObject( |
| 54 | + 'articles', |
| 55 | + '1', |
| 56 | + new Attribute('title', 'JSON API paints my bikeshed!'), |
| 57 | + new SelfLink('http://example.com/articles/1'), |
| 58 | + new ToOne( |
| 59 | + 'author', |
| 60 | + $dan->identifier(), |
| 61 | + new SelfLink('http://example.com/articles/1/relationships/author'), |
| 62 | + new RelatedLink('http://example.com/articles/1/author') |
67 | 63 | ), |
68 | | - new SelfLink('http://example.com/articles/1/relationships/comments'), |
69 | | - new RelatedLink('http://example.com/articles/1/comments') |
| 64 | + new ToMany( |
| 65 | + 'comments', |
| 66 | + new ResourceIdentifierCollection( |
| 67 | + $comment05->identifier(), |
| 68 | + $comment12->identifier() |
| 69 | + ), |
| 70 | + new SelfLink('http://example.com/articles/1/relationships/comments'), |
| 71 | + new RelatedLink('http://example.com/articles/1/comments') |
| 72 | + ) |
70 | 73 | ) |
71 | 74 | ) |
72 | 75 | ), |
|
0 commit comments