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

I think it really depends on the project.  In general, I usually have a 1:1 setup like others have said, but not always.  For example, in a reporting section, I have one controller (Reports) but it uses several different models (orders, clients, suppliers, etc.).  As others have said, models represent people or things ("entities") your app tracks (in my case it's orders, clients etc.), even if they work with more than one database table.

But in your case, it sounds like you're doing this, but keeping it a bit too general.  A "forms" model could potentially handle everything an app does!  If your model is getting too big and confusing, maybe break it down further.  That happened to me awhile back, where I had 2 different types of clients with 2 very different types of orders.  In that case, having a single "orders" model would have gotten unnecessarily huge and complicated, so each type of order had its own model.  The "bottom line" is that you should do whatever works best in your situation, as long as you maintain a good separation of concerns.

HTH Smile
Reply


Messages In This Thread
RE: 1 controller = 1 model VS. 1 controller = multiple model - by mfox - 09-10-2018, 09:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB