diff --git a/src/PersistentData/PersistentDataManager.php b/src/PersistentData/PersistentDataManager.php index e3096d2..edf857b 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);