Hello.
Is there already a function to get from an AkHasMany object an array with this structure
array (
[0] => ( ['field1'] => ['value1'], ['field2'] => ['value2'], ['field3'] => ['value3], ['field4'] => ['value4'])
[1] => ( ['field11'] => ['value11'], ['field22'] => ['value22'], ['field33'] => ['value33], ['field44'] => ['value44'])
)
Thanks
-- Simone
Well, I couldn't way so here the function
function toHash($object) {
foreach ($object->_columns as $columnName => $columnDetails) {
$row[$columnName] = $object->$columnName;
}
return $row;
}
Just call it this way :
$myMatrix = array_map("toHash",$this->MyMaster->myChildren);
Now I'm just wondering if something like this already exists in Akelos. Anybody ?
-- Simone
ActiveRecord has ->select() and ->collect() which are a bit different.
but
->select($myChildren,list_of_columns_to_select...);
would be equivalent to what you did.
1 to 3 of 3