From 28302f050d5cfdb4da9ccf84b0c23dd02ca81733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Berg?= <32747776+MisterMountain@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:01:56 +0200 Subject: [PATCH 1/2] added conversion from array to object for the directory to row property modifier --- .../PropertyModifier/PropertyModifierDictionaryToRow.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php b/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php index 2a60ab3e2..bcc432bf1 100644 --- a/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php +++ b/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php @@ -77,7 +77,10 @@ public function transform($value) ); } $result = []; - foreach ($value as $key => $properties) { + foreach ($value as $key => $properties) { + if (is_array($properties)) { + $properties = (object) $properties; + } if (! is_object($properties)) { throw new InvalidDataException( sprintf('Nested "%s" dictionary', $key), From 6311236b116d938ed9e9592bb154cee54ce20e7e Mon Sep 17 00:00:00 2001 From: Bjoern Berg Date: Mon, 25 Nov 2024 16:53:29 +0100 Subject: [PATCH 2/2] fix phpsniffer complaints --- .../PropertyModifierDictionaryToRow.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php b/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php index bcc432bf1..f3bb6bd12 100644 --- a/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php +++ b/library/Director/PropertyModifier/PropertyModifierDictionaryToRow.php @@ -77,10 +77,10 @@ public function transform($value) ); } $result = []; - foreach ($value as $key => $properties) { - if (is_array($properties)) { - $properties = (object) $properties; - } + foreach ($value as $key => $properties) { + if (is_array($properties)) { + $properties = (object) $properties; + } if (! is_object($properties)) { throw new InvalidDataException( sprintf('Nested "%s" dictionary', $key), @@ -90,7 +90,7 @@ public function transform($value) $properties->$keyColumn = $key; $result[] = $properties; - } + } return $result; }