Hi All,
Bit of a newbie question here, but I did not find any references in the forum on this.
By way of context, I've been maintaining our internal PHP portals for the last 6 years. It was written as a MV (no C) using PHP, and Ajax in a Wordpress site. We used no php framework and coded all the PHP data interfaces by hand. The time has come to start from scratch and I feel like I have been doing a lot of catchup learning about the new technologies. From all my research, I am settling on CI as robust framework to use (although aurelia looks good, but too new I suspect).
Now to the question! In my existing php data interfaces I often use a mysql view for reading but write to the table. Typically, when needed, there is a view that is paired with a table. The best example of this is an invoice master and detail table. The total of the invoice is the sum of (detail amounts * detail quantity), and we all know it is bad practice to store that number. When I get all the invoices for a client, I want to see the total value of the invoice returned with the date, invoice number etc. I use a MYSQL View to sum that together and join it with the invoice master so the view returns date, invoice no, ..., total. This makes my php code simple because I do not have to do any looping and calculating just pass the results straight on up.
To reiterate, this means that in my current model I am reading from a mysql_view but writing to a table (my model knows which fields are read-only and dont exist in the table so it does not expose modification functions for them).
So as a best practice question, would/could you do something similar in CI?
Thanks
Matt.