phundament / app

Dockerized Yii2 web application base
http://phundament.com
Other
310 stars 129 forks source link

Error after register by \Yii::$app->user->identity->username #173

Open songwutk opened 9 years ago

songwutk commented 9 years ago

After I register user, error show.

" PHP Notice – yii\base\ErrorException Trying to get property of non-object".

in /var/www/qiudao/modules/admin/views/layouts/main.php \Yii::$app->user->identity->username

Cause of not complete login but call app variable.

Should I create new var that checkby isset() ?

$username=''; if (isset(\Yii::$app->user->identity->username) $username = \Yii::$app->user->identity->username;

and the others.

schmunk42 commented 9 years ago

Should I create new var that checkby isset() ?

$username=''; if (isset(\Yii::$app->user->identity->username) $username = \Yii::$app->user->identity->username;

Yes I think so.

and the others.

Which ones?

The admin module is meant to be customized, if needed.