Closed alejandroiglesias closed 12 years ago
Pull request is targeted towards an invalid branch (3.2/master). Usually, this means you have targeted the master, rather than develop branch. Please correct this and try again. Thanks!
Pull request targeted at branch 3.2/master and should be 3.2/develop.
This is invalid anyways, if you don't want the results as objects, use: $query->as_object(FALSE)->execute()->as_array()
.
Oh, great info! Thank you very much Woody!
2011/12/2 Woody Gilk < reply@reply.github.com
This is invalid anyways, if you don't want the results as objects, use:
$query->as_object(FALSE)->execute()->as_array()
.
Reply to this email directly or view it on GitHub: https://github.com/kohana/database/pull/25#issuecomment-2997459
Ohh, but you can't use that with models, just with Database_Builder.
My proposal is for Database_Result, so we can do:
$users_array = ORM::factory('user')->find_all()->each_as_array();
Thank you very much!
2011/12/6 Ernestas Lisauskas < reply@reply.github.com
@alejandrogarciaiglesias
http://forum.kohanaframework.org/discussion/9488/oop-design-question-where-should-as_array_recursive-go http://dev.kohanaframework.org/issues/4193
Reply to this email directly or view it on GitHub: https://github.com/kohana/database/pull/25#issuecomment-3032310
So why there is a as_array() method if Database_Result shouldn't take care of data format?
This is what I use to accomplish this:
$data_as_array = array_map( create_function( '$obj', 'return method_exists($obj,"as_array") ? $obj->as_array() : $obj;'), ORM::factory('user')->find_all()->as_array());
This should accomplish what you want though it isn't pretty.
Not pretty!
...e results.