This is kind of a basic question, but I haven’t really seen a solid answer recommendation yet. As I’ve been developing with Yii, code related to controllers, views, data, etc… has a place. Post logic, goes into to the controller, menus get setup in views. Data conditions, scopes, behaviors, go into the model.
Fast forward a little…I wrote some code to resize images. I put it all into the actionIndex under a new controller. What I would have liked to do is put the code into a class, then build out some more robust functionality.
Where would I put this new class I want to create? Is it a "component"? Right now, everything in my components folder is an override of a base Yii class…so I tend to think, not there.
Do I create an Image Manipulation "widget"? Or are widgets more suited for use in customizing views?
Do I create an extension, even though I have no intent of packaging for distribution/re-installation?
It feels wrong to just leave linear code in the controller, when it should be built into a class.
Does anyone have any recommendations on when/how/why you would create your own custom classes and WHERE you would put them?