mcirkova
(M Cirkova)
1
Hi , I have this 2 models User and Company , i want from User to get this property:
Yii::$app->user->company, also i have function getCompany(); in User models,
but gets me this error :
Getting unknown property: yii\web\User::company
How can i solve this ? Thanks
anhchau1986
(Hoangchau3008)
2
make sure your User class have property company and see config file
'user' => [
'identityClass' => 'app\models\User',
]
achertovsky
(Alexander Chertovsky)
3
You must define your identity class inside config.
This may help
'components' => [
//....
'user' => [
'identityClass' => Your\User\Class,
'class' => 'yii\web\User',
],
//....
],