Fixes a bug where singular values of singular relations are not being set

This commit is contained in:
Sam Georges 2014-05-28 12:36:45 +10:00
parent 40efd04558
commit b47e3587f4
1 changed files with 1 additions and 1 deletions

View File

@ -530,7 +530,7 @@ class FormController extends ControllerBehavior
$singularTypes = ['belongsTo', 'hasOne', 'morphOne'];
foreach ($saveData as $attribute => $value) {
if ($model->hasRelation($attribute) && in_array($model->getRelationType($attribute), $singularTypes))
if (is_array($value) && $model->hasRelation($attribute) && in_array($model->getRelationType($attribute), $singularTypes))
$this->setModelAttributes($model->{$attribute}, $value);
else
$model->{$attribute} = $value;