Welcome Guest, Not a member yet? Register   Sign In
Returning standard objects with different queries
#2

[eluser]jedd[/eluser]
Hey, well done you for managing to slip the question mark in as the absolutely last character in your post! It certainly made it interesting to work out what your problem is.

If I may summarise, and ask you to clarify - your problem is that want to be able to present your data in a consistent format to your controllers, but without having to actually modify the format of that data as you retrieve it from disparate tables with necessarily disparate formats - is that right?

My approach to this alleged problem is two-fold. First, I use arrays rather than objects - I find they're easier to mung (to taste) before sending them back to the controller. Second, different functions obviously want different data, and different data necessarily will take on different formats based on its nature. Much like the CI core does, I try to write anything that might one day use multiple bits of data (even if today it only takes one piece) to work with an array of data types. That is, even if I know I have one item I'm playing with, if I think that my controller or view might one day want / be able to handle multiples, I'll ensure my model wraps the data into an array.


Messages In This Thread
Returning standard objects with different queries - by El Forum - 10-31-2009, 06:18 AM
Returning standard objects with different queries - by El Forum - 10-31-2009, 08:30 AM
Returning standard objects with different queries - by El Forum - 10-31-2009, 09:05 AM
Returning standard objects with different queries - by El Forum - 10-31-2009, 09:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB