CodeIgniter Model Design

I have a user model that has properties such as username, password, first name, last name, address ... etc.

What is the best way to set these properties on a model so that I can insert or update data in a database?

Should I add, update ..ect methods that take the entire list of parameters or just an array.

My questions are: how would you write a simple user model with the above fields in CI?

+4
source share
1 answer

One way is to use CodeIgniter models , which I find pretty anonymous. CodeIgniter will simply provide a Db object, and you are likely to finish executing the queries in the database.

I use a different way: with a CI project, I use Propel , which is an ORM (basically what you want to do) and is relatively easy to integrate, you can get the integration guide I wrote here.

Hope I can help!

+1
source

All Articles