I have two Models:
Multiple\Backend\Models\Users
Multiple\Backend\Models\UserType
In User model class inside initialize():
public function initialize() {
$this->belongsTo("user_type_id", "UserType", "user_type_id", array(
'alias' => "user_type"
));
}
And in UserTypeModel:
public function initialize(){
$this->setSource("user_type");
$this->hasMany("user_type_id", "Users", "user_type_id", array('alias' => "users" ));
}
in wherever controller I call Users::find() method and acess UserType return:
$users = Users::find();
foreach($users as $user){
echo $user->user_type->user_type_descr;
}
And return a Exception: Model 'UserType' could not be loaded;
where I am going wrong?