Eating my own dogfood Upgrading to CakePHP RC1

Well today I took the time to upgrade to CakePHP 1.2 RC1 in the spirit of ‘eating your own dogfood’. I got the usual warnings about vendor() being deprecated. I also took the time to switch over all my Bindable calls to the fresh core Containable Behavior. Which for the most part consisted of changing restrict() calls to contain() calls. It took me a while to hunt them all down, because I forgot about find and replace. Another trip up was when using Bindable you have to specify the Model you are doing the find against in the restriction. With Containable specifying a Model in its own containment will cause a warning.

Other Gotchas

I didn’t really have too many huge snags. The biggest one was related to the Xml libs. There has been considerable work done on the XML libs and the treatment and implementation of text nodes has changed a fair bit. I use the xml libs to parse my recent tracks feed from last.fm. In beta cake the following worked just fine:

Show Plain Text
  1. $track->child('artist')->value

However, with the changes to Xml text nodes are now real nodes, and as such need to be retrieved with a child() call.

Show Plain Text
  1. $track->child('artist')->child('#text')->value

A little bit more complicated but in the end the Xml is better off for it.

Component changes and redirect().

At one point components were all to inherit off of Component this is not the case today. Between beta and RC1 Component was changed from a base class back to a loader. If you have any components that extend Component your redirects will cease to work, as Component::beforeRedirect() will loop forever. So make sure your components all extend Object it will save you time and hair.

So once those minor things were solved, it was smooth sailing. All in all a very easy and manageable transition.

Comments

You are the man. That redirect thing caught me for a loop. cough

After that everything was smooth sailing. Thanks!

Pat

anonymous user on 7/17/08

Comments are not open at this time.