Hi,
I've got a number of models defined in my application. In each model I have the function:
PHP Code:
function generateOptionsFromMeta() {
$enumList = Array();
foreach($this->_metadata AS $fieldName => $fieldAttributes) {
if('enum' == substr($fieldAttributes['DATA_TYPE'],0,4)) {
foreach(eval('return '.str_replace('enum', 'Array', $fieldAttributes['DATA_TYPE'].';')) AS $key => $value) {
$enumList[$fieldName][$value] = $value;
}
}
}
return($enumList);
}
Obviously this needs re-factoring, where can I place these types of functions that are usable on every model without modification?
Thanks
Andrew