Oth\’s Thoughts


generateEnumList

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'];
break;
}
} 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🙂
    http://groups.google.com/group/cake-php/msg/550ec44d856548d4

  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 )

Google+ photo

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

Connecting to %s


%d bloggers like this: