in a model named Book which I would like to access with a console command, but since the model is trying to get the user component, "unrelated" code fails to execute as well. The purpose of this is that a logged in user (which belongs to a specific store) should get specific stock information for that store which he/she is related to.
What thoughts do you guys have on this one? The only solution I’ve made so far is to make a condition like: “if isset(Yii::app()->user)” and include the relation depending on that, but it doesn’t feel so YII.
It’s a good idéa and probably more accurate to use a scope since that would be visible together with the condition, but in our current situation it’s not needed that much since we always work with one store at a time, so its more like a default scope.