「非オブジェクトのメンバ関数formNameフォーム()の呼び出し」...私はモデル</p> <pre><code>... public function rules() { return [ [['status', 'date_update', 'date_create'], 'integer'], [['date_update', 'date_create'], 'required'], ]; } </code></pre> <p>についてmultilanguagedコンテンツ 私を保存しよう
public function getContent($lang_id = null) {
$lang_id = ($lang_id === null) ? Lang::getCurrent()->id : $lang_id;
return $this->hasOne(AboutLang::className(), ['post_id' => 'id'])->where('lang_id = :lang_id', [':lang_id' => $lang_id]);
}
コントローラ
01についてマイAboutLangモデルpublic function rules()
{
return [
[['post_id', 'lang_id', 'title', 'content'], 'required'],
[['post_id', 'lang_id'], 'integer'],
[['title', 'content'], 'string'],
];
}
マイ
public function actionCreate()
{
$model = new About();
$aboutLang = new AboutLang();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,'aboutLang'=>$aboutLang]);
}
}
と私のビュー(フォームを作成します)
...
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($aboutLang, 'title')->textInput() ?>
<?= $form->field($aboutLang, 'content')->textInput() ?>
enter code here
と私はで$ aboutLangを入れたときに、私はエラーを取得するフォームを作成