From da2801560d663a276a6d841dbf0bd871c64a8d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 28 May 2023 15:29:28 +0200 Subject: [PATCH] iterate in $data until fields for empty relation are over --- src/PersistentData/PersistentDataManager.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PersistentData/PersistentDataManager.php b/src/PersistentData/PersistentDataManager.php index f35add7..404a0ee 100644 --- a/src/PersistentData/PersistentDataManager.php +++ b/src/PersistentData/PersistentDataManager.php @@ -278,7 +278,10 @@ class PersistentDataManager implements IPersistentDataManager $method = 'set' . str_replace('_', '', ucwords($relation, '_')); $model->$method($relationModel); } else { - next($data); + while (substr($key, 0, strlen($relation . '__')) === $relation . '__') { + next($data); + $key = key($data); + } } next($relations);