after some changes, its working fine...
function getEnumValues($columnName=null)
{
if ($columnName==null)
{
//no field specified,return empty set
return array();
}
//This currently only works if you are using the cake
conventions
strictly
//i.e. are not using a special table and not usine non-default
plurals
$tableName = strtolower(Inflector::pluralize($this->name));
$result = $this->query("SHOW COLUMNS FROM {$this->tablePrefix}
{$tableName}");
foreach($result as $column)
{
if($column['COLUMNS']['Field'] == $columnName)
{
$enum = $column['COLUMNS']['Type'];
$values = explode("','",
preg_replace("/(enum)\('(.+?)'\)/","\\2",
$enum) );
//cake want assoc values, not numerical values
$assoc_values = array();
foreach ( $values as $value )
{
$assoc_values[] = $value;
}
break;
}
}
return $assoc_values;
}
On Sep 28, 3:47 am, cakeFreak <[EMAIL PROTECTED]> wrote:
> By the way, is the getEnumValues function ok for cake 1.2?
>
> Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---