The controller action is not changing properties values either passing variables to view

hello; I have a controller that I extended from dektrium\user\controllers\securityController a YII user extension, the problem I notice its actions are not changing it own property values and other such as yii::$app properties. What can the problem be?




 public function actionHome($lang=null)

    {

$lan='HELLO';

     $langchoisie = Yii::$app->request->get('lang');

  yii::$app->language='fr-FR';


         $model = \Yii::createObject(LoginForm::className());

         $this->performAjaxValidation($model);

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

            return $this->render('index');

        }

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

            'model'  => $model,

            'module' => $this->module,'lan'=>$lan

        ]);

    }

In this code when I access in the view yii::$app->language the value is ‘en-US’ its default and when I access $lan in view it gives undefined variable $lan…

Please I need your help to understand what is wrong.




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

            return $this->render('index');

        }



If the code enters in this block, where is $lan defined?

If you can check the first instruction of the action, that’s where I defined $lan=‘HELLO’; but I’ve gotten the solution: I removed my controller from be extended from The (dektrium Yii2-user)extension’s controller and it solved the problem.

I’m happy that you have solved, but the code is wrong, because if the code enter in this block




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

            return $this->render('index');

        }



the ‘index’ view is rendered without $lan parameter.

Thanks!!!