CodeIgniter Forums
Model as both a database and data abstraction layer - 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: Model as both a database and data abstraction layer (/showthread.php?tid=47875)



Model as both a database and data abstraction layer - El Forum - 12-26-2011

[eluser]Unknown[/eluser]
I was having issues working with MVC as I was under the impression that Models should only be used for manipulating the database. I really don't know if MVC wants it that way or we, as programmers, decides what's best.

User guide(not sure if I read it there) hints that we may do away without a Model. So I'm thinking, no official guideline(use of models) exists for the community in contrast to CI dedicating a whole page for Coding style guidelines.

I just confirmed that most, even those who has written books for CI, use their models for both manipulating database and the 'session'.

Now I wonder, is this really how MVC is supposed to be done?

I'm thinking, what about the db mappers? I just tried PHP-ActiveRecord through sparks and realized the class can work as your Model.

What do you do. Do you create a separate model class or you just manipulate your session in the controller?