From cff5306f7e0bf1a8ac75b71f4e4b1a82fceed7bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavs=20G=C5=ABtmanis?= Date: Thu, 19 Dec 2024 14:29:22 +0200 Subject: [PATCH] fix(SFT-1672): table layout migration check for undefined array keys --- ...m241126_113656_UpdateTableLayoutProperties.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/plugin/src/migrations/m241126_113656_UpdateTableLayoutProperties.php b/packages/plugin/src/migrations/m241126_113656_UpdateTableLayoutProperties.php index 2ca95b322..64c8ccea1 100644 --- a/packages/plugin/src/migrations/m241126_113656_UpdateTableLayoutProperties.php +++ b/packages/plugin/src/migrations/m241126_113656_UpdateTableLayoutProperties.php @@ -29,21 +29,24 @@ public function safeUp(): bool continue; } - if ('select' === $row['type']) { - $tableLayout[$index]['options'] = explode(';', $row['value']); + $type = $row['type'] ?? ''; + $value = $row['value'] ?? ''; + + if ('select' === $type) { + $tableLayout[$index]['options'] = explode(';', $value); $tableLayout[$index]['value'] = $tableLayout[$index]['options'][0] ?? ''; } else { $tableLayout[$index]['options'] = []; } - if ('checkbox' === $row['type']) { - $tableLayout[$index]['value'] = (bool) $row['value']; + if ('checkbox' === $type) { + $tableLayout[$index]['value'] = (bool) $value; } $tableLayout[$index]['placeholder'] = ''; - if ('checkbox' === $row['type']) { - $tableLayout[$index]['checked'] = (bool) $row['value']; + if ('checkbox' === $type) { + $tableLayout[$index]['checked'] = (bool) $value; } else { $tableLayout[$index]['checked'] = false; }