question already in the title. Is it considered bad practice to use CWebUser in models? Because I do it all the time in scopes, relations, and so on … Coming across the same issues described in the topics below (exception thrown when Yii::app()->user is called in console applications) I think, I might need to change my current way of handling session information in models.
Irregardless of whether or not it’s bad practice, I think it would be better to make it more generic. For example:
Instead of checking if the model "added me", it makes more sense to design it so that you can check if the model "added user x". Then you just send in the Yii::app()->user->id as input instead of having it hardcoded in.