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

(08-27-2018, 01:30 PM)albertleao Wrote:
(08-27-2018, 01:20 PM)skunkbad Wrote:
(08-27-2018, 09:33 AM)albertleao Wrote: ...

such as a single database table.

...

THIS

Although, you could have a model for a group of related tables, if you choose. I do this for authentication, because the tables are all related, and most don't need their own model.

Personally, I find it a lot easier and more organized to keep my models in a 1 to 1 relationship with database tables, then if I have some functionality I want to reuse that uses multiple models, I create a library. I find it easier to test as well since you can easily inject stubs for models in the library.

So then how do you handle joins?
Reply


Messages In This Thread
RE: 1 controller = 1 model VS. 1 controller = multiple model - by skunkbad - 08-27-2018, 05:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB