I'm just starting to convert some basic applications to CodeIgniter and I'm trying to make sure that I start off on the right footing.
Most actions in my controller require at least 1 query and as I see it there are 2 ways to go about this...
Combine the queries into a single method in the model, therefore making only a single call to the model from the controller.
Have each query be its own method in the model, then call each method in turn from the controller.
So far I've adopted my own policy but I'm not sure if it's advised or breaking the MVC pattern.
If the queries are directly related to one another and only ever run together in sequence (the 2nd query is dependent on the 1st running successful), or data from the 1st query is passed to a 2nd query and it's the 2nd query that returns the actual display result set, then I go with #1
If each of the queries is returning its own individual result set for display, then I go with #2
Is there a recommended way to structure and separate the logic in this scenario?
The last thing I want to do is cause myself a nightmare later down the line. My gut instinct is telling me that as much of the logic should be in the controller as possible.