Welcome Guest, Not a member yet? Register   Sign In
turn array into object active record can use
#6

[eluser]mddd[/eluser]
Well, the tricky part is that the code I wrote above relies on the fact that there is a variable called $result_object inside the CI DB result class. If a future version of CI changes that, the code will not work. That's why I say it's 'dirty'.

It would be a bit less dirty if you replaced the result_object() method in the CI DB result class with a method that gets the result and immediately decodes it. This could be done by extending the class. There could be an optional flag: result_object($use_decode = false) { ... } But still, that would leave places where stuff could break: the result_object method calls _fetch_object and that could also change in some future version.. so I guess there is always a possibility for breakage..


Messages In This Thread
turn array into object active record can use - by El Forum - 06-09-2010, 09:29 AM
turn array into object active record can use - by El Forum - 06-09-2010, 09:42 AM
turn array into object active record can use - by El Forum - 06-09-2010, 10:10 AM
turn array into object active record can use - by El Forum - 06-09-2010, 10:28 AM
turn array into object active record can use - by El Forum - 06-09-2010, 10:52 AM
turn array into object active record can use - by El Forum - 06-09-2010, 11:02 AM
turn array into object active record can use - by El Forum - 06-09-2010, 11:37 AM
turn array into object active record can use - by El Forum - 06-09-2010, 11:50 AM
turn array into object active record can use - by El Forum - 06-09-2010, 12:54 PM
turn array into object active record can use - by El Forum - 06-09-2010, 02:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB