diff --git a/src/SilbinaryWolf/Components/ComponentService.php b/src/SilbinaryWolf/Components/ComponentService.php
index 6a1b5d4..934c700 100644
--- a/src/SilbinaryWolf/Components/ComponentService.php
+++ b/src/SilbinaryWolf/Components/ComponentService.php
@@ -95,6 +95,7 @@ public function generateTemplateCode(array $res, $parser)
}
foreach ($jsonData as $propertyName => $value) {
if (is_array($value)) {
+ $value = self::recursivelyConvertFlatArraysToArrayList($value);
$value = 'new '.ArrayList::class.'('.var_export($value, true).')';
}
$phpCodeValueParts[] = "\$_props['".$propertyName."'][] = ".$value.";";
@@ -244,4 +245,19 @@ public function renderComponent($name, array $props, SSViewer_Scope $scope)
//
return $result;
}
+
+ private static function recursivelyConvertFlatArraysToArrayList(array $array)
+ {
+ foreach ($array as $prop => &$value) {
+ if (is_array($value)) {
+ $value = self::recursivelyConvertFlatArraysToArrayList($value);
+ }
+ unset($value);
+ }
+ if (isset($array[0])) {
+ $array = new ArrayList($array);
+ //$array = 'new '.ArrayList::class.'('.var_export($array, true).')';
+ }
+ return $array;
+ }
}
diff --git a/tests/ComponentTest.php b/tests/ComponentTest.php
index 7af0594..d309dee 100644
--- a/tests/ComponentTest.php
+++ b/tests/ComponentTest.php
@@ -527,6 +527,64 @@ public function testJSONPropertyErrorHandling()
}
}
+ public function testJSONDeeplyNested()
+ {
+ $template = <<