strike one against cakePHP

So I’m looking into the cakePHP framework, because, well why not. (for those not in the know cake is to php as rails is to ruby) Install is quite painless, but I’m still in the documentation, and I have already bumped into something that makes me cringe. The naming conventions require some classes to be singular, and some to be plural, and there is automatic translation between the the two. (I.E. you don’t declare where the singular class should look for the plural one, it just appends an s and goes to look for it) I’m sure some of you know that English is just not that regular a language.

This of course means there has to be a way to add exceptions

Cake’s naming conventions can be really nice – you can name your database table big_boxes, your model BigBox, your controller BigBoxesController, and everything just works together automatically. The way CakePHP knows how to tie things together is by inflecting the words between their singular and plural forms.

There are occasions (especially for our non-English speaking friends) where you may run into situations where CakePHP’s inflector (the class that pluralizes, singularizes, camelCases, and under_scores) might not work as you’d like. If CakePHP won’t recognize your Foci or Fish, editing the custom inflections configuration file is where you can tell CakePHP about your special cases. This file is found in /app/config/inflections.php.

In this file, you will find six variables. Each allows you to fine-tune CakePHP inflection behavior.

Ugg!! I can just imagine getting caught by this one as part of a learning curve and walking away from the whole damn framework because of it. But I guess this is one open manhole cover that I managed not to fall into.

3 thoughts on “strike one against cakePHP”

  1. Hey there. Actually, the “quirks” with naming conventions is really way less of a big deal than you’d think. Learning what goes where is pretty quick, and after that you don’t really think about it.

    Cake also provides pretty easy ways to explicitly override the standard naming conventions when that becomes necessary, so you can always resort to that if all else fails.

  2. I am currently creating my own Framework which will be suitable for ALL known programming languages. Obviously, this complicates matters. I have adopted the singular/plural concept in cakePHP to help me minimise the complexity of my Framework. The Framework also has methods that have gender specific prefixes and a built in debugger that automatically resolves all errors using the Future Perfect Tense.

    Programmers can learn so much from natural languages.

    I don’t have a name for the Framework yet. I’m hoping it will eventually name itself.

  3. Wow Max,
    That sounds like quite a project? Is it far enough along that there is some code you could float to me? I would be interested in hearing more about what your doing. with it.

Leave a Reply

Your email address will not be published. Required fields are marked *