[eluser]optimal[/eluser]
Hello,
I'm looking for some advice on best practices for representing a calculated or custom property of a model in CI. I've checked the docs, forum archives, and BambooInvoice but only found straight database calls in the models and no additional or computed values.
For example, if I wanted to add a mathematical "difference" value to each row of my query result set (based on the difference between two columns), and then expose this value as a model property, how would I best accomplish this?
Put another way, if I'm going to call my "get_all" function and return the query results to my controller, what's the best way to pop some additional values in there?
Two options that won't work for me in this case are denormalizing the database by adding a calculated column (and thus creating database redundancy), or using DBMS-specific functions (creating platform dependencies or at minimum the need to ensure there aren't any!).
Thank you!