我想知道OctoberCMS后端的Backend\Behaviors\FormController类中更新的字段的模型名称这里是图片在这里 输入图片描述
这是在我自己的插件中更新表单后将触发的update_onSave()函数,该插件位于Backend\Behaviors\FormController
/**
* AJAX handler "onSave" called from the update action and
* primarily used for updating existing records.
*
* This handler will invoke the unique controller overrides
* `formBeforeUpdate` and `formAfterUpdate`.
*
* @param int $recordId Record identifier
* @param string $context Form context
* @return mixed
*/
public function update_onSave($recordId = null, $context = null)
{
$this->context = strlen($context) ? $context : $this->getConfig('update[context]', self::CONTEXT_UPDATE);
$model = $this->controller->formFindModelObject($recordId);
$this->initForm($model);
$this->controller->formBeforeSave($model);
$this->controller->formBeforeUpdate($model);
$modelsToSave = $this->prepareModelsToSave($model, $this->formWidget->getSaveData());
Db::transaction(function () use ($modelsToSave) {
foreach ($modelsToSave as $modelToSave) {
$modelToSave->save(null, $this->formWidget->getSessionKey());
}
});
$this->controller->formAfterSave($model);
$this->controller->formAfterUpdate($model);
Flash::success($this->getLang("{$this->context}[flashSave]", 'backend::lang.form.update_success'));
if ($redirect = $this->makeRedirect('update', $model)) {
return $redirect;
}
}
这是也位于Backend\Behaviors\FormController中的formAfterUpdate(),它将在保存更新表单后触发。
/**
* Called after the updating form is saved.
* @param Model
*
*/
public function formAfterUpdate($model)
{
echo $model;
}
我想知道我的插件中的模型名称已经更新,但它只显示像这样更新的字段。
{"flagstateid":80,"name":"VIETNAM","code":"[VN]","image":null}