From f1dbcb780af4433cd184358aaa3ba9fb32143ad8 Mon Sep 17 00:00:00 2001 From: sankam-nikolya Date: Mon, 25 Apr 2016 19:43:31 +0300 Subject: [PATCH] Update SaveRelationsBehavior.php --- src/SaveRelationsBehavior.php | 3 +++ 1 file changed, 3 insertions(+) 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;