Fixes a bug where singular values of singular relations are not being set
This commit is contained in:
parent
40efd04558
commit
b47e3587f4
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue