@@ -32,7 +32,7 @@ public static function setResponseDataLinks(array &$mappings, array &$value)
32
32
$ data = [];
33
33
$ type = $ value [Serializer::CLASS_IDENTIFIER_KEY ];
34
34
35
- if (\is_scalar ($ type )) {
35
+ if (\is_scalar ($ type ) && ! empty ( $ mappings [ $ type ]) ) {
36
36
$ copy = $ value ;
37
37
RecursiveFormatterHelper::formatScalarValues ($ copy );
38
38
if (!empty ($ copy [Serializer::CLASS_IDENTIFIER_KEY ])) {
@@ -105,7 +105,7 @@ public static function setResponseDataRelationship(array &$mappings, array &$arr
105
105
$ parentType
106
106
);
107
107
108
- if (!empty ($ selfLink = $ mappings [$ parentType ]->getRelationshipSelfUrl ($ propertyName ))) {
108
+ if (!empty ($ mappings [ $ parentType ]) && ! empty ( $ selfLink = $ mappings [$ parentType ]->getRelationshipSelfUrl ($ propertyName ))) {
109
109
$ href = \str_replace ($ idProperties , $ idValues , $ selfLink );
110
110
if ($ selfLink != $ href ) {
111
111
$ propertyNameKey = DataAttributesHelper::transformToValidMemberName ($ propertyName );
@@ -126,7 +126,7 @@ public static function setResponseDataRelationship(array &$mappings, array &$arr
126
126
$ parentType = $ parent [Serializer::CLASS_IDENTIFIER_KEY ];
127
127
128
128
//Removes relationships related to the current resource if filtering include resources has been set.
129
- if (!empty ($ mappings [$ parentType ]->isFilteringIncludedResources ())) {
129
+ if (!empty ($ mappings [$ parentType ]) && ! empty ( $ mappings [ $ parentType ] ->isFilteringIncludedResources ())) {
130
130
foreach ($ newData [JsonApiTransformer::RELATIONSHIPS_KEY ][$ propertyName ] as $ position => $ includedResource ) {
131
131
if (count ($ mappings [$ parentType ]->getIncludedResources ()) > 0 &&
132
132
false === in_array ($ type , $ mappings [$ parentType ]->getIncludedResources (), true )
@@ -222,7 +222,7 @@ public static function setResponseDataRelationshipSelfLinks($propertyName, array
222
222
$ data = [];
223
223
$ parentType = $ parent [Serializer::CLASS_IDENTIFIER_KEY ];
224
224
225
- if (\is_scalar ($ parentType )) {
225
+ if (\is_scalar ($ parentType ) && ! empty ( $ mappings [ $ parentType ]) ) {
226
226
$ copy = $ parent ;
227
227
RecursiveFormatterHelper::formatScalarValues ($ copy );
228
228
if (!empty ($ copy [Serializer::CLASS_IDENTIFIER_KEY ])) {
0 commit comments