Skip to content

Commit 7e85b9c

Browse files
committed
Update DataIncludedHelper.php
1 parent ea24d0f commit 7e85b9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Helpers/DataIncludedHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static function setResponseDataIncluded(array &$mappings, array $array, a
4343

4444
//Remove those resources that do not to appear in the getIncludedResources array.
4545
foreach ($inArrayValue as $position => $includableValue) {
46-
if ($mappings[$parentType]->isFilteringIncludedResources()
46+
if (!empty($mappings[$parentType]) && $mappings[$parentType]->isFilteringIncludedResources()
4747
&& false === in_array(
4848
$includableValue[Serializer::CLASS_IDENTIFIER_KEY],
4949
$mappings[$parentType]->getIncludedResources(),
@@ -73,7 +73,7 @@ protected static function removeTypeAndId(array &$mappings, array $copy)
7373
if (!empty($copy[Serializer::CLASS_IDENTIFIER_KEY])) {
7474
$type = $copy[Serializer::CLASS_IDENTIFIER_KEY];
7575

76-
if (\is_scalar($type)) {
76+
if (\is_scalar($type) && !empty($mappings[$type])) {
7777
foreach ($mappings[$type]->getIdProperties() as $propertyName) {
7878
unset($copy[$propertyName]);
7979
}

0 commit comments

Comments
 (0)