[EMAIL PROTECTED] wrote:
> To be honest, I don't think either are great solutions, because:
>
> - if we put the code in our data model, then only that model can access
> that function, we'd have to duplicate the code for other models that
> might want to use an enum field.

So abstract just the part that grabs the enum, and put it in AppModel.

> - that snippet doesnt work with tables with underscores, to remedy that
> you can $this->table
> rather than doing this...
> $tableName = strtolower(Inflector::pluralize($this->name));

Better yet:
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$tableName = $db->getFullTableName($this, false);

> Also if I create my own AppModel with the getEnumValues method in, that
> resides in my app/models directory, I get errors. It only works when I
> add the method to the cake/app_model.php class.

Hmm, what errors do you get?  To Cake, there is no difference between
loading cake/app_model.php and app/app_model.php.  There must be
something else going wrong.

> Anyway, it would be nice to get this updated in Cake, its a bit
> inconsistent to have the functionality in the scaffolding but not
> available in the model functionality. Is it just a case of submitting a
> new ticket on the trac repository to get it looked at?

Not really.  Enums are a MySQL-specific feature (who said hack? I know
I didn't!) that has no equivalent in any other database platform, and
is technically the wrong way of going about it anyway.  The proper way
is to add constraints to the field, or use a lookup table that maps
symbolic values.

> Cheers
> 
> James


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to