Welcome Guest, Not a member yet? Register   Sign In
Question about proper model use in CI?
#1

[eluser]MyDarkPassenger[/eluser]
I was wondering a question about proper use of models in CI. Basically, I'm wondering if it's allowed to use your model to save data or if it's only to be used for input/output functions. For example, I was a fan of ORM in Kohana which allows you to pass an ID to the constructor and access the record properties through the model functions, etc. I was wondering if I could use this design with CI or if I should pass an ID to a load function and return the results as an array to the controller. I could make either system work I'm just wondering what's more appropriate?
#2

[eluser]bigtony[/eluser]
Models are used to separate out the data elements of your application from the rest of the system. In other words, they manage the storage and retrieval of data (typically using a relational database, though it doesn't have to be).

Typical methods in a model would be to add, update, delete, get one record, get a selection of records, get all records, etc.




Theme © iAndrew 2016 - Forum software by © MyBB