views:

55

answers:

3

I have a database table named 'abuses'. While baking the application the bake command named it's controller classname as "abuses" and filename as "abuses_controller.php" but when I baked the model the filename was "Abus.php" and classname was "Abus".

Is that a bug in cakePHP ? or did I miss something ?

Has anyone encountered the same problem yet ?

Thanks

+1  A: 

Take a look at CakePHP's Inflector class.

NullUserException
+2  A: 

its due to inflections check this http://book.cakephp.org/view/953/Inflections

chinni776
but "abuses" is an english word and it is wrongly pluralizing it while baking the application. My question was if it is a bug in cakephp ?
Gaurav Sharma
cakephp will be using regex to singularize and pluralize words so it will recognize both abuses and boxes as one
chinni776
@chinni776: I don't think so the class will singularize the word "boxes" as "box" and "abuses" as "abus". It removes the 'es' from the word for singularization. Give this code "pr(Inflector::singularize("abuses"));" a try.!
Gaurav Sharma
what im telling is they could have used a regex to remove the last 2 letters 'es' in a word and also when i looked in cake/libs/inflector.php in the document section they have said' Inflector pluralizes and singularizes English nouns.' abuse is a noun abuses i dont know
chinni776
+4  A: 

You can add your custom inflection rules if the Cake Inflector gets it wrong (it's only human, and a singular '~e' is probably uncommon for a plural '~es'):
http://book.cakephp.org/view/953/Inflections

deceze
+1 I'd also just write in a custom inflection rule for this word.
DavidYell