Yii provides ORM based development which is OK for normal development. My question is, in my application there are many user related data like user info, user settings, user preferences and so on. Here user means the current logged in user.
If somewhere I need the background picture setting of the User I do the following
$user = User::model()->findByPk(Yii::app()->user->id);
$bgImage = $user->settings->backgroundImage;
I repeat the same thing on another places of the application wherever I need background image. Means again create instance of the $user which I don't think a good approach. So, is there a way by which we don't need to instantiate the user class again and again??? Remember I don't like the session approach.