These are chat archives for dektrium/yii2-user

8th
Mar 2016
Negruzzi Cristian
@EndErr
Mar 08 2016 08:07
Как можно получить доступ к к классу User из любово места? К примеру имея Orders(со связкой по orders.iduser->Yii::$app->user->id) хочу получить что-то подобное User->orders но не знаю откуда взять этот "User". В самом модуле User и в Orders создал связи.
Is there a way to get access to User object? Having Orders (in relation with user by orders.iduser=Yii::$app->user->id) I need to get smth like user->orders, but don't know how to get the User. In both models User and Orders I already have relations.
Negruzzi Cristian
@EndErr
Mar 08 2016 09:57
@ComradePashka already use relations, the question is how to get access to User class to have smth like user->getOrders().
Now I i'm using: $user = \frontend\models\user\User::find()->where(['id'=>Yii::$app->user->id])->one(); $user->orders;