Top 10 things to look forward to in CakePHP 1.3

(Update: 8/26/2011… and a few years later we can look forward to CakePHP 2.0).

With CakePHP 1.3 release is just about on the horizon, there are a few developments that I am particularly excited about.
There are some great summaries and previews at, but still a few things are somewhat scattered, so here’s my attempt to better highlight some goodies in 1.3. Forgive shameless copy/paste in some parts, but really it goes without saying that all the credit goes to the developers for baking yet another awesome cake.

Maybe, the proper title should be “Top 10 things I’m looking forward to”… but either way, I hope you’ll find something useful and if there are some interesting features/updates that I’ve not included, please do share them in the comments.

So, without “further dudes”…

10. Missing behaviors trigger an error

Using behaviors that do not exist, now triggers a cakeError making missing behaviors easier to find and fix.

9. GROUP BY support in the Containable behavior

Finally, we should be able to do something along the lines of:

'contain' => array(
    'Answer' => array(
        'fields' => array('Answer.value', 'COUNT(*) AS count'),
        'group' => array('Answer.value')

Which really makes reporting across multiple models much easier and any previously required hackery is no longer needed.

8. “Missing” model methods will trigger a warning

In the past, when Model::someMethod() was not found, the method itself was attempted to be executed as a query. Now, we should see a warning that such method isn’t there. This does affect some existing code, but is a sound improvement overall.

7. Support for engine type in MySQL DB

The new schema shell will properly recognize the engine type used by your tables (for example MyISAM vs InnoDB).
This was a bit of a pain in the “old days” when running a new schema would always default to MyISAM.

6. Helpers are now referenced by $this->HelperName

This is actually a very nice improvement because it ensures that your helper object will not conflict with some random variable from your view.
For example, if you have an ImageHelper and you also had an $image variable, in the old days the collision between the two would create major problems, especially because the conflict can happen completely unknowingly to the user (consider an app with lots and lots of views). Such an error was too easy to make.

5. Updates to the Form helper

What could be better than the lovely input(s) methods of the Form helper?
How about the suggestions outlined in this ticket

To summarize, we should have greater control over the form element placement therefore having much more flexibility in the way the forms are laid out.

4. Error logging with debug at zero

This has been a long-requested feature and it is finally making it’s way into 1.3
You can use Configure::write(‘log’, $val), to control which errors are logged when debug is off. By default all errors are logged.
The $val is a standard PHP constant such as E_WARNING.

3. New fixture task

Baking fixtures is now another tasty piece of cake. One of the lovely feature is that it properly handles UUID’s.

2. Sweet prefix routing
The old admin routing is gone in the way of proper prefix routing, so if you wish to have:

It is now easily accomplished with a simple setup in the core.php:

Configure::write(‘Routing.prefixes’, array(‘admin’, ‘editor’, ‘user));

Of course, you’ll need appropriate “prefixed” action such as editor_publish() in your relevant controllers.

1. Brand new way to handle Javascript and Ajax

This is probably the most anticipated and welcomed change in 1.3. One of the great things about CakePHP has always been the fact that it did not depend on any other libraries or what have you … (well other than PHP). In the old days that paradigm was somewhat “broken” because Ajax helper required the use of the Prototype JS library.
It wasn’t necessarily a huge problem, but for people who preferred to work with other JS frameworks… the helpers were of little help and mostly dead weight in the framework.
Not only that, the the new JS helper and improved HTML helper solve a lot of other little problems, which make CakePHP 1.3 something to really look forward to.

Well… it’s no worth repeating what’s already said at 1.3 wiki regarding the new helpers.

Go cake!

Related Posts