I am developing an admin module for a Yii powered app. My question is regarding models that need to be accessed from both the main app and the admin module.
Should I be creating a separate model within the module, or should I use the same model? The reason I ask is that the model is to have slightly different methods in the admin. If I do create another model, how do I specify which model I want to use?
I think, a good model should definitely work in both places. If you have different methods for admin, maybe rethink your model methods and try to unify them.
You could use scenarios for that. I usually try to reuse as much code as possible. This is also a maintenance issue. If you add attributes, you’d have to touch 2 files later.