public function actionCreate() { $model = new Test(); if ($model->load(\Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } return $this->render('create', ['model' => $model]); }
/** * @return \yii\db\ActiveQuery */ public function getTest() { return $this->hasOne(Test::className(), ['id' => 'test_id']); }