Top 10 things to look forward to in CakePHP 1.3

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 code.cakephp.org, 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:
http://www.example.com/user/profiles/edit
http://www.example.com/admin/users/delete
http://www.example.com/editor/articles/publish

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!

About these ads

19 Responses to Top 10 things to look forward to in CakePHP 1.3

  1. David says:

    I’m curious.. Are these changes actually working or are those wishes that may happen sometimes pretty soon ?

  2. scrogson says:

    Great stuff mate. Thanks for the info. I’ve been using the 1.3-dev branch and merging in updates from the 1.3-misc branch as things progress. I’m loving 1.3 all around.

  3. Pingback: Enlaces del 07-10-09 | evelio.info

  4. Ivan says:

    This is probably the most complete post about the upcoming features, glad you wrote it down :-)

  5. teknoid says:

    @David

    I would say only two or three items are still not complete,the rest are there already.

    @scrogson

    I’ve made a switch a little while ago and now we are putting it to work on a pretty large project. So far so good ;)

    @Ivan

    No problem.

  6. Joel Perras says:

    Plugin datasources is another one to add to your list. That, along with some updated docs on how to write datasources in the book, should help generate more plug & play datasources for your favourite APIs.

  7. Pingback: CakePHP : signets remarquables du 09/09/2009 au 08/10/2009 | Cherry on the...

  8. I’m excited for the new JS helper or whatever it’s going to be called. To be able to drop in mootools is a great bonus for using cake.

  9. teknoid says:

    @Ryan Rampersad

    It definitely beats the original approach.
    Still, I foresee a lot of straight JS (framework of choice) coding… not that it’s a bad thing in any way.

  10. Wow man, you just said whats on my mind. Great list.

  11. sophy says:

    Good news! but you know when cake1.3 will release? because now i use cakephp1.3-dev

  12. teknoid says:

    @sophy

    For the last few years the major releases have been done around Christmas time… so possibly this year will be no different.

  13. sophy says:

    Thank you so much! I hope

  14. Ødegård says:

    Does this mean that I could use prefix routing to make several user access levels? In a controller I could have:
    admin_delete
    admin_edit, moderator_edit
    admin_add, moderator_add, user_add

    and voila you’d have three levels of access. I’m new to cake and may think completely wrong about this.

  15. teknoid says:

    @Ødegård

    No, you are correct. However that will only easily allow you to come up with that type of setup/routing.

    How your actually handle the actual restrictions is an entirely different ball game.

  16. Pingback: CakePHP Digest #21 – Whose Left? | PseudoCoder.com

  17. Pingback: links for 2009-10-24 « undefined

  18. dogmatic69 says:

    what about virtual fields… that is the coolest thing ever.

  19. teknoid says:

    @dogmatic69

    Very good point, but at the time of the writing it was not yet in 1.3 :)

    I should update the article, ’cause you are correct… that is probably one of the top features now.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 25 other followers

%d bloggers like this: