Reputation: 18318
I have a user model that has properties such as username, password, first name, last name, address...etc
What is the best way to have these properties set on the model so I can insert or update into the database?
Should I have add, update..ect methods that take a whole list of parameters or just an array.
My questions is: How would you write a simple User model with the above fields in CI?
Upvotes: 4
Views: 649
Reputation: 4637
One way is using CodeIgniter's models which I find rather anoying. CodeIgniter will just provide a Db object and you'll probably end up doing queries into the database.
I use another way, with CI project I use Propel, which is an ORM (basically what you want to do) and it's relatively easy to integrate, you can get an integration guide I wrote here.
Hope I can help!
Upvotes: 1