CodeIgniter Forums
models and db tables? or a more sophisticated approach? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: models and db tables? or a more sophisticated approach? (/showthread.php?tid=43680)



models and db tables? or a more sophisticated approach? - El Forum - 07-20-2011

[eluser]nourdine[/eluser]
I have a very general question for you guys. I have been trying to figure out what is the best way of creating and using models and I came to the conclusion that it's ok to create a model for each table in the db. This way a model would represent all the available actions on that specific table we are using. Too simple an approach maybe? have some other idea on the topic?


models and db tables? or a more sophisticated approach? - El Forum - 07-20-2011

[eluser]marcogmonteiro[/eluser]
That may depend on what you are doing I think.
There are cases where tables are just to store related data to other table. For example articles -> tags you probably don't need a tags model, just the articles model that has all the content related with articles.