From 8bc3088e1219d991be55ea31515a4f776671aac5 Mon Sep 17 00:00:00 2001 From: iglocska Date: Tue, 23 Aug 2022 14:50:13 +0200 Subject: [PATCH] fix: [revert] meta fields unindexing - required for the saving of vchanges --- src/Controller/Component/CRUDComponent.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Controller/Component/CRUDComponent.php b/src/Controller/Component/CRUDComponent.php index c530c6c..693b2ab 100644 --- a/src/Controller/Component/CRUDComponent.php +++ b/src/Controller/Component/CRUDComponent.php @@ -413,6 +413,7 @@ class CRUDComponent extends Component $metaFieldsTable->patchEntity($entity->meta_fields[$index], [ 'value' => $new_value, 'meta_template_field_id' => $rawMetaTemplateField->id ], ['value']); + debug($entity); $metaFieldsTable->patchEntity( $entity->MetaTemplates[$template_id]->meta_template_fields[$meta_template_field_id]->metaFields[$meta_field_id], ['value' => $new_value, 'meta_template_field_id' => $rawMetaTemplateField->id], @@ -621,7 +622,7 @@ class CRUDComponent extends Component if (empty($data[$metaField->meta_template_id][$metaField->meta_template_field_id])) { $data[$metaField->meta_template_id][$metaField->meta_template_field_id] = []; } - $data[$metaField->meta_template_id][$metaField->meta_template_field_id][] = $metaField; + $data[$metaField->meta_template_id][$metaField->meta_template_field_id][$metaField->id] = $metaField; } return $data; } @@ -655,7 +656,7 @@ class CRUDComponent extends Component $metaTemplates[$i]['hasNewerVersion'] = $newestTemplate; } } - $data['MetaTemplates'] = array_values($metaTemplates); + $data['MetaTemplates'] = $metaTemplates; return $data; }