This dilemma might be a bit hard to explain but I’ll try my best.
Currently I’m not satisfied with the way I’m accessing the application’s user model from within my module and I’m looking for good suggestions on how to do this.
My module needs to access the user model for e.g. listing users. The name of the user model can be configured in the module configuration so as long as the application has an user model everything should work fine.
The problem is that I’m not exactly sure how I should call the user model. I have a few ideas which I’m not too satisfied with:
[*]Create a new instance of the user model and save it in a member variable in the module class, e.g. $user or $_user (with getter and setter). Then call the user model via the module.
[*]Make a wrapper application component for the user model from which the user model can be accessed. This sounds like a long shot but it is just a crazy thought I had one day.
The problem is that I cannot call the user class statically (e.g. User::model()->…) because this would require me to hard-code the user class name in the module source which is not an option.
I need a good and most of all clean solution to this. If you even have the wildest suggestions please do not hesitate to post it below.
Thanks for reading.