to understand

Hey there, I have problem learn yii, so how to me to learn structur write yii?

like below

public function actionLogin()

{


    if (!\Yii::$app->user->isGuest) {


        return $this->goHome();


    }





    $model = new LoginForm();


    if ($model->load(Yii::$app->request->post()) && $model->login()) {


        return $this->goBack();


    }


    return $this->render('login', [


        'model' => $model,


    ]);


}

$model->load(bla…bla), so I not undertand,I think this automatic. how I want make register form (CRUD) to database if structur write yii like that, anyone help me… #yii

I think that the only row to understand is




if ($model->load(Yii::$app->request->post()) && $model->login()) {



This means:

  1. model->load(\Yii::$app->request->post())

From source: https://github.com/yiisoft/yii2/blob/master/framework/base/Model.php#L819

It simply fill $model attributes from $_POST[formName] array.

  1. $model->login

It executes $model login method.

Always refer to Yii source code, because it is really well documented.