Sorry CeBe, I just tried to sound clever about something I know very little about.
But here is what I do:
I use dynamic actions in a master controller. With dynamic actions, I mean this:
All CRUD actions do more-or-less the same thing and they don’t use much of the model’s info. For example: for a single table, the Create action would need the model-name and maybe the PK. But that is about all. The rest is done by the model.
So if you store the model-names and PK-names of all your tables in a separate meta-data-table, then you can re-use that single dynamic action to create all your models in all your single tables.
All my controllers are almost empty. They just have enough data to know what meta-data-table records to read. Then, all my controllers extend from a master controller - which contains all the dynamic actions.
All my actions in this master controller can handle ‘single table’, ‘one-to-many’, ‘many-to-many’, and ‘tree’ structures.
Okay, my master controller has 2000 lines, but if you change one thing, then it works for your entire application. You don’t have to make the changes in all your other crud controllers as well. And you have zero duplicate code in your controllers.
But such a huge controller could load unused actions/functions as well. So an even better idea might be to store these dynamic actions in separate files. Then in your controllers, you only import/include the actions you need. But still, if the dynamic action is updated in its own file, then it will be updated for all controllers.
Controllers can obviously have their own unique actions as well. But such actions should be very few, because they will quickly become dynamic actions when you need to re-use them in other controllers as well.
I’m new to yii and mvc, so maybe my reply is not relevant to this topic. I just know that I love dynamic actions, and I hate duplicate code. So any way to ‘include’ actions will be super.