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);