Refers to my previous question : Show values in TDropDownList in PRADO. ok fine the array i receive from query is an object array like :
ContactRecord Object ( [id] => 1 [name] => leo [_recordState:protected] => 1 [_connection:protected] => [_invalidFinderResult:protected] => [_e:TComponent:private] => Array ( ) )
ContactRecord Object ( [id] => 2 [name] => ganda [_recordState:protected] => 1 [_connection:protected] => [_invalidFinderResult:protected] => [_e:TComponent:private] => Array ( ) )
If I convert it in to array like:
Array ( [key 1] => leo [key 2] => ganda )
then I can populate values into TDropDownList.
Now can anyone help me to convert array structure which I need ... ?
Again thanks
If you don't care about the keys:
array_map(function (ContactRecord $o) { return $o->name; }, $origArray)
Otherwise:
$res = array();
foreach ($origArray as $obj) {
$res[$o->id] = $o->name;
}