Halycon models do not declare forceFill
Only bind purgeable fallback event once (only needed once) Refs https://github.com/rainlab/translate-plugin/issues/54#issuecomment-256067096
This commit is contained in:
parent
7b0f33e9b3
commit
50d3ffb035
|
|
@ -90,7 +90,7 @@ trait FormModelSaver
|
|||
$model->addPurgeable($attributesToPurge);
|
||||
}
|
||||
else {
|
||||
$model->bindEvent('model.saveInternal', function() use ($model, $attributesToPurge) {
|
||||
$model->bindEventOnce('model.saveInternal', function() use ($model, $attributesToPurge) {
|
||||
foreach ($attributesToPurge as $attribute) {
|
||||
unset($model->attributes[$attribute]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,7 +319,10 @@ class Form extends WidgetBase
|
|||
$data = $this->getSaveData();
|
||||
}
|
||||
|
||||
$this->model->forceFill($data);
|
||||
if (method_exists($this->model, 'forceFill')) {
|
||||
$this->model->forceFill($data);
|
||||
}
|
||||
|
||||
$this->data = (object) array_merge((array) $this->data, (array) $data);
|
||||
|
||||
foreach ($this->allFields as $field) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue