login - yii2 inner join identityinterface -


i'm learning yii2, wanna use identity interface after login, show personal information of worker, have 3 tables: users, workers , persons, after login need person data (name, lastname,genre,etc), i'm using it:

public static function findidentity($id) {     $user = users::find()     ->select("id,login,name")     ->innerjoinwith(["workers","workers.person"])     ->where("activate=:activate", [":activate" => true])     ->andwhere("id=:id", ["id" => $id])     ->one();     return isset($user) ? new static($user) : null; } 

but, when i'm trying "name" in view can't see anything, i'm using :

 <?= yii::$app->user->identity->name?> 

and value null,
doing wrong?? happens after successfull login. thanks.

i'm not sure because can't testing in moment try way

    public static function findidentity($id)     {         $user = users::find()         ->select("id,login,name")         ->joinwith('workers')         ->where('workers.person' => $id)         ->andwhere('activate' => true)         ->andwhere('id => $id])         ->one();         return isset($user) ? new static($user) : null;     } 

however right value in identity username , not name

yii::$app->user->identity->username 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -