diff --git a/src/SaveRelationsBehavior.php b/src/SaveRelationsBehavior.php index 86bc1ed..a1e72ec 100644 --- a/src/SaveRelationsBehavior.php +++ b/src/SaveRelationsBehavior.php @@ -86,6 +86,9 @@ class SaveRelationsBehavior extends Behavior } if ($relation->multiple === true) { $newRelations = []; + if(!is_array($value)){ + $value = []; + } foreach ($value as $entry) { if ($entry instanceof $relation->modelClass) { $newRelations[] = $entry;