File tree Expand file tree Collapse file tree 4 files changed +29
-12
lines changed Expand file tree Collapse file tree 4 files changed +29
-12
lines changed Original file line number Diff line number Diff line change 3
3
All notable changes to this project will be documented in this file. This project adheres to
4
4
[ Semantic Versioning] ( http://semver.org/ ) and [ this changelog format] ( http://keepachangelog.com/ ) .
5
5
6
+ ## [ 1.1.0] - 2022-01-03
7
+
8
+ ### Fixed
9
+
10
+ - Fixed setting the top-level ` jsonapi ` value on the ` Document ` class, which was not setting the cast value.
11
+
12
+ ### Removed
13
+
14
+ - The ` RelationshipDocument ` no longer merges relationship links with the top-level document links. This is because we
15
+ now expect the top-level links provided to the encoder to already have the relationship links merged. The ` core `
16
+ package takes care of this in the relationship response classes, while also providing the capability for the developer
17
+ to turn off link merging if desired (which is a better implementation). This change is considered non-breaking because
18
+ the core package dependency has been upgraded and there were existing bugs in the links merging implementation within
19
+ the ` RelationshipDocument ` class. I.e. it would fail if either of the self or related links were missing, or if the
20
+ relationship was hidden - so removing this merging fixes bugs in the implementation.
21
+
6
22
## [ 1.0.0] - 2021-07-31
7
23
8
24
Initial stable release, with no changes since ` 1.0.0-beta.1 ` .
Original file line number Diff line number Diff line change 26
26
"php" : " ^7.4|^8.0" ,
27
27
"ext-json" : " *" ,
28
28
"illuminate/support" : " ^8.0" ,
29
- "laravel-json-api/core" : " ^1.0.0 " ,
29
+ "laravel-json-api/core" : " ^1.1 " ,
30
30
"laravel-json-api/neomerx-json-api" : " ^4.0.2"
31
31
},
32
32
"require-dev" : {
Original file line number Diff line number Diff line change 27
27
28
28
abstract class Document implements JsonApiDocument
29
29
{
30
-
31
30
/**
32
31
* @var ExtendedEncoder
33
32
*/
@@ -81,7 +80,7 @@ abstract protected function encode(): string;
81
80
public function withJsonApi ($ jsonApi ): self
82
81
{
83
82
if ($ value = JsonApi::nullable ($ jsonApi )) {
84
- $ this ->jsonApi = $ jsonApi ;
83
+ $ this ->jsonApi = $ value ;
85
84
}
86
85
87
86
return $ this ;
@@ -226,4 +225,12 @@ protected function encoder(): ExtendedEncoder
226
225
{
227
226
return $ this ->encoder ;
228
227
}
228
+
229
+ /**
230
+ * @return Mapper
231
+ */
232
+ protected function mapper (): Mapper
233
+ {
234
+ return $ this ->mapper ;
235
+ }
229
236
}
Original file line number Diff line number Diff line change 24
24
25
25
class RelationshipDocument extends Document
26
26
{
27
-
28
27
/**
29
28
* @var JsonApiResource
30
29
*/
31
- private JsonApiResource $ resource ;
30
+ protected JsonApiResource $ resource ;
32
31
33
32
/**
34
33
* @var string
35
34
*/
36
- private string $ fieldName ;
35
+ protected string $ fieldName ;
37
36
38
37
/**
39
38
* @var mixed
40
39
*/
41
- private $ data ;
40
+ protected $ data ;
42
41
43
42
/**
44
43
* RelationshipDocument constructor.
@@ -69,8 +68,6 @@ protected function serialize(): array
69
68
{
70
69
return $ this
71
70
->encoder ()
72
- ->withRelationshipSelfLink ($ this ->resource , $ this ->fieldName )
73
- ->withRelationshipRelatedLink ($ this ->resource , $ this ->fieldName )
74
71
->serializeIdentifiers ($ this ->data );
75
72
}
76
73
@@ -81,9 +78,6 @@ protected function encode(): string
81
78
{
82
79
return $ this
83
80
->encoder ()
84
- ->withRelationshipSelfLink ($ this ->resource , $ this ->fieldName )
85
- ->withRelationshipRelatedLink ($ this ->resource , $ this ->fieldName )
86
81
->encodeIdentifiers ($ this ->data );
87
82
}
88
-
89
83
}
You can’t perform that action at this time.
0 commit comments