Welcome Guest, Not a member yet? Register   Sign In
Variables in Model Classes
#2

There is no hard and fast rule, as far as CI is concerned.

My own practice is to use a Library for derived or run-time variables, with the Library calling the Model, which only contains variables that correspond to the database.

I did this for logical separation, but also convenience. It's very easy to save or load a Model that has a 1:1 between variables and db fields. From a programming standpoint I just call the Library from my Controller and it is up to the Library to know whether the variable comes from the Library or the Model.

I took inspiration for this methodology from the Ion-Auth library. You'll find some helpful magic methods in his Library files for doing this.
Reply


Messages In This Thread
Variables in Model Classes - by olivebean - 02-17-2015, 11:57 AM
RE: Variables in Model Classes - by colonelclick - 02-18-2015, 11:35 AM
RE: Variables in Model Classes - by casa - 04-05-2015, 09:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB