MainelyDesign.com Blog

Upgrading CakePHP Application to 1.3 (from 1.2)

Posted on 09/27/2010 at 09:33 pm by Kevin Wentworth
Viewed 14,290 times | 2 comments

I've been waiting to publish a completed article until after I was done with my upgrade to CakePHP 1.3.  Well, it's taking a while.  I'm not blaming the CakePHP upgrade from 1.2 to 1.3 for taking so long.  I'm actually doing several large-scale changes to my code base, my server and my repository structure.  Until that time, I'm going to publish some notes I've been making for this article.

CakePHP $form->create() ID Renames

Huge Gotcha!  We depend on the ID of the form to perform CSS transformations and several jquery functions depend on the form ID.  What's changed?  Two things I've noticed:

  • There is no default form ID of ModelNameEditForm.  Instead, it WILL ALWAYS BE ModelNameActionForm
  • Additionally, on prefix routes (i.e. admin-side), forms take on the ID of ModelNamePrefixActionForm (this one messed up some jquery)

Cache Config and Prefix

Cache::config needed a prefix set to '' otherwise it would only delete files beginning with 'cake_'.  This is new behavior in that before, with no prefix set/specified it would delete all files.  This left my scratching my head for a while.

Session Flash

If you have $session->flash();, you need to echo $session->flash();.

Router::Connect() alias now needs TWO routes

Huge change to controller aliasing via routes!  After much thought and some discussion (I finally got on IRC...) I came to the realization that two routes are needed to have /controller/ route to /alias/ with ALL actions (including default/index).

Themed is now Theme! Yay!

Changing /theme/ to /theme/ for static assets (LINK TO this post).  I only had to update every reference in my database to /theme/

Function Renames

Changing $model->del() to $model->delete.  Same with $session->del(), $folder->ls().

$text->truncate() is now an array of options:

Instead of this: $summary = $text->truncate($clean_summary, 350, '...', false, true);

It will be this: $summary = $text->truncate($clean_summary, 350, array('exact'=>false, 'html'=>true));

Modifying a page title in the view? 

I used to use $this->set('title', 'New Page Title');.  Now you need to use $this->set('title_for_layout', 'New Page Title');

 

There will be more,

-Kevin Wentworth

Bookmark and Share

Tags for Upgrading CakePHP Application to 1.3 (from 1.2)

Cakephp | Upgrade

Comments for this Posting

Posted by Ian

on 10/11/10

Did you find any performance improvement with switching to 1.3?

Posted by Kevin Wentworth

on 17/11/10

I sure did. No hard statistics, but performance definitely improved.

Sorry, comments are closed for this posting.

Please Email Kevin if you have any questions. Thanks!

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design