Oth\’s Thoughts


Posted in CakePHP by othy on June 3, 2006

as the name suggests, this method ( in your AppModel ) generate a list based on the values of an enum field.

function generateEnumList($fieldName)
foreach($this->_tableInfo->value as $field)
if($field['name'] == $fieldName) {
$enum = $field['type'];
} foreach(split("','", substr($enum, 6, -2)) as $num => $name) { $return[$name] = $name;
} return $return;

2 Responses to 'generateEnumList'

Subscribe to comments with RSS or TrackBack to 'generateEnumList'.

  1. Daneel said,

    I see you liked my code 🙂

  2. othy said,

    hah! that’s funny, cool code then 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: