From 3686e943193b541dbd8e0b36f4f94fdc0b273189 Mon Sep 17 00:00:00 2001 From: Seth Shaw Date: Fri, 24 Jun 2022 12:48:01 -0700 Subject: [PATCH] preserve arrays without @id (#62) --- src/Normalizer/NormalizerBase.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Normalizer/NormalizerBase.php b/src/Normalizer/NormalizerBase.php index 7de3f48..b8a40ac 100644 --- a/src/Normalizer/NormalizerBase.php +++ b/src/Normalizer/NormalizerBase.php @@ -102,12 +102,8 @@ protected static function deduplicateTypesAndReferences(array $array): array { */ private static function deduplicateArrayOfIds(array $array): array { $temp_array = []; - if (!isset($array[0]['@id'])) { - // No @id key, so just return the original array. - return $array; - } foreach ($array as $val) { - if (array_search($val['@id'], array_column($temp_array, '@id')) === FALSE) { + if (!array_key_exists('@id', $val) || array_search($val['@id'], array_column($temp_array, '@id')) === FALSE) { $temp_array[] = $val; } }