CodeIgniter Forums
1 model per table or 1 model per controller? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: 1 model per table or 1 model per controller? (/thread-10975.html)



1 model per table or 1 model per controller? - El Forum - 08-20-2008

[eluser]TheActionCombo[/eluser]
Is it better practice to have 1 model for each table or 1 model for each controller? I believe following strict mvc it should be 1 model per table, but 1 model per controller makes more sense since many model methods will use multiple tables.


1 model per table or 1 model per controller? - El Forum - 08-20-2008

[eluser]sikkle[/eluser]
This is not much mvc related realy.

At the moment, i prefer thinking about those model as object.

Many many way to handle that.

good luck !


1 model per table or 1 model per controller? - El Forum - 08-21-2008

[eluser]stuffradio[/eluser]
I generally try to use 1 model per table, but some believe you should use many models...


1 model per table or 1 model per controller? - El Forum - 08-21-2008

[eluser]wiredesignz[/eluser]
Your models should be a representation of a real thing (hence the name Model), if your model requires information from many sources to represent your `Thing`, make it so.