while designing my first MVC application with Yii, I came across the following question:
I’d like to keep the Controllers generic so it stays DRY and the call names and action verbs stay the same. But this seems to conflict with the design suggested by all sample code I saw - Controllers are not generic, i.e. they assume a data input method and render certain views. So I would have to write one for each input method * number of models (or variations thereof, lots of ugly switch cases in the controller or sub classes inheriting from a common controller class), which is barely feasible.
Is there any elegant way to abstract the input/output methods and formats away from the controller, translating those to generic controller actions in a pre-processor maybe? Or do you have another approach for this scenario?
Thanks in advance.