From d335395a7ab26206c33fc7b5e3bf51bf6611d288 Mon Sep 17 00:00:00 2001 From: Thomas Templeton Date: Mon, 24 Jun 2024 21:19:58 +1000 Subject: [PATCH 1/2] Fix #898 --- CHANGELOG.md | 5 +++++ src/Field.php | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 987892d3..3f81c3f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased (4.x) + +### Fixed +- Fixed a bug where content migrations that set Neo field values could fail to set more than one block in some cases + ## 4.2.4 - 2024-06-18 ### Fixed diff --git a/src/Field.php b/src/Field.php index c31a5a74..bed200b1 100644 --- a/src/Field.php +++ b/src/Field.php @@ -1394,8 +1394,13 @@ private function _createBlocksFromSerializedData(array $value, ElementInterface $baseBlockFieldNamespace .= '.blocks'; } } else { - $newBlockData = $value; - $newSortOrder = array_keys($value); + $newBlockData = []; + $newSortOrder = []; + + foreach ($value as $i => $blockData) { + $newBlockData["new$i"] = $blockData; + $newSortOrder[] = "new$i"; + } } /** @var Block[] $blocks */ From c0f8213781d7fcff9d1424d4968ee51a503ef265 Mon Sep 17 00:00:00 2001 From: Thomas Templeton Date: Mon, 24 Jun 2024 21:22:48 +1000 Subject: [PATCH 2/2] Release 4.2.5 --- CHANGELOG.md | 2 +- composer.json | 6 +++--- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f81c3f9..459149b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased (4.x) +## 4.2.5 - 2024-06-24 ### Fixed - Fixed a bug where content migrations that set Neo field values could fail to set more than one block in some cases diff --git a/composer.json b/composer.json index fd7b3880..32599cf9 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "spicyweb/craft-neo", "description": "A Matrix-like field type that uses existing fields", - "version": "4.2.4", + "version": "4.2.5", "type": "craft-plugin", "keywords": [ "cms", @@ -21,7 +21,7 @@ "support": { "issues": "https://github.com/spicywebau/craft-neo/issues", "source": "https://github.com/spicywebau/craft-neo", - "docs": "https://github.com/spicywebau/craft-neo/blob/4.2.4/README.md", + "docs": "https://github.com/spicywebau/craft-neo/blob/4.2.5/README.md", "rss": "https://github.com/spicywebau/craft-neo/commits/4.x.atom" }, "require": { @@ -44,7 +44,7 @@ "schemaVersion": "4.0.0", "class": "benf\\neo\\Plugin", "changelogUrl": "https://github.com/spicywebau/craft-neo/blob/4.x/CHANGELOG.md", - "downloadUrl": "https://github.com/spicywebau/craft-neo/archive/refs/tags/4.2.4.zip" + "downloadUrl": "https://github.com/spicywebau/craft-neo/archive/refs/tags/4.2.5.zip" }, "config": { "allow-plugins": { diff --git a/package.json b/package.json index b8424ef6..5488b702 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "craft-neo", - "version": "4.2.4", + "version": "4.2.5", "description": "A Matrix-like field type that uses existing fields", "main": "webpack.config.js", "scripts": {