From 1d6bead9e60be1a91d8c0fa0dddfbf7d65aa68de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Zapletal?= Date: Fri, 14 Jun 2024 15:10:27 +0200 Subject: [PATCH] Fixed excluded columns --- src/Http/Request/Collection/Form/UpdatingFormRequest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Http/Request/Collection/Form/UpdatingFormRequest.php b/src/Http/Request/Collection/Form/UpdatingFormRequest.php index fe5149c..be712b1 100644 --- a/src/Http/Request/Collection/Form/UpdatingFormRequest.php +++ b/src/Http/Request/Collection/Form/UpdatingFormRequest.php @@ -88,7 +88,9 @@ public function process(array $data): Response // Format one-to-many data foreach ($schema->getOneToManyColumns() as $column) { - $row[$column['name']] = array_map(fn($item) => $item['id'], $row[$column['name']]); + if (array_key_exists($column['name'], $row)) { + $row[$column['name']] = array_map(fn($item) => $item['id'], $row[$column['name']]); + } } // Format many-to-one data @@ -100,7 +102,9 @@ public function process(array $data): Response // Format-many-to-many data foreach ($schema->getManyToManyColumns() as $column) { - $row[$column['name']] = array_map(fn($item) => $item['id'], $row[$column['name']]); + if (array_key_exists($column['name'], $row)) { + $row[$column['name']] = array_map(fn($item) => $item['id'], $row[$column['name']]); + } } /** @var string $rowId */