I know I can loop through each level of the object, but I would like a more simple approach to this.
QueryResult Object
(
[queryLocator] =>
[done] => 1
[records] => Array
(
[0] => SObject Object
(
[type] => type_1
[fields] =>
[sobjects] => Array
(
[0] => SObject Object
(
[type] => type_2
[fields] =>
[sobjects] => Array
(
[0] => SObject Object
(
[type] => type_3
[fields] =>
[sobjects] => Array
(
[0] => SObject Object
(
[type] => type_4
[fields] =>
[sobjects] => Array
(
[0] => SObject Object
(
[type] => type_5
[fields] =>
[Id] => 12345_I_need_this
)
)
)
)
)
)
)
)
)
)
[size] => 1
)
I need this Id value of type_5, how could I get this in a simple solution.
Some other points to think about:
- I will not know how big or how deep the object of arrays will go, could be more or less than 5
I have heard about recursion but havn't found anything I think I could use that keeps it simple. Maybe some better tutorials would help me out. If I did know in what part of the array of object the value I neede was in could I just call it directly? something like: $object[5]->id ???