Browse Source

Update SaveRelationsBehavior.php

tags/1.1.0
sankam-nikolya 9 years ago
parent
commit
f1dbcb780a
  1. 3
      src/SaveRelationsBehavior.php

3
src/SaveRelationsBehavior.php

@ -86,6 +86,9 @@ class SaveRelationsBehavior extends Behavior
} }
if ($relation->multiple === true) { if ($relation->multiple === true) {
$newRelations = []; $newRelations = [];
if(!is_array($value)){
$value = [];
}
foreach ($value as $entry) { foreach ($value as $entry) {
if ($entry instanceof $relation->modelClass) { if ($entry instanceof $relation->modelClass) {
$newRelations[] = $entry; $newRelations[] = $entry;

Loading…
Cancel
Save