Welcome Guest, Not a member yet? Register   Sign In
1 controller = 1 model VS. 1 controller = multiple model
#17

(08-27-2018, 05:11 PM)skunkbad Wrote: So then how do you handle joins?

Mostly in libraries.

In my workflow, if the join is pulling in child data, I use a function within the parent model. For example, if you have 1 blog post with 10 tags, I'd have a function called 'tags()' in my BlogPost model that I could call to get related data.


I do have some models with join statements but I try to keep them as clean as possible. Keeping separation can make a huge difference down the road if your app gets big.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply


Messages In This Thread
RE: 1 controller = 1 model VS. 1 controller = multiple model - by albertleao - 08-28-2018, 09:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB