A Weblog written, styled and hacked by Joel Moss
Haven’t done one of these in a while, probably because there haven’t been many feature changes in the 1.2 branch. But the last month or so have seen a few small feature changes that I think could be very useful.
The first of these changes is the transitioning of the configuration away from global constants. I am sure you are fully aware of the plethora of constants within the core.php file. Well, the final release of 1.2 will see these replaced with singleton calls to the Configure class.
So instead of
define('DEBUG', 2);
you get…
Configure::write('debug', 2);
Good move, as any sort of globals can cause issues.
Now this is one feature that I really loved when I played with Ruby on Rails. I really got to love the simplicity and the ‘that makes sense’ mentality of RESTful routes. If you have no idea what I am on about, I highly recommend that you take a little time to watch and listen to DHH’s keynote presentation at last years RailsConf.
Anyway, at the end of July, I noticed changeset 5454, which made changes to the Router. More importantly it added support for RESTful routes, which take advantage of the hidden beauty of the HTTP GET, POST, PUT and DELETE verbs.
I have yet to play with this fully, so not 100% sure of how it works, but I would like to thank the core team for including it. And I hope to write more about it in a future article.
A recent changeset also introduced prefix based routing. Which lets you specify a prefix in any route, which is then prepended to the action called.
For example, with the prefix variable set to admin in your route, you could access the following URL:
/admin/posts/create
which would then call the admin_create action within the posts controller.
So we still have some new things to look forward to in 1.2. In fact I am beginning to think that CakePHP 1.2 would be best refered to as CakePHP 2.0.
Enjoy!
My name is Joel Moss, a web developer and all round nice guy, living in Manchester, England. I am currently working full time for ShermansTravel.com, but I fill whatever spare time I have with lots of good and wholesome "stuff"! Like developing my own ideas; such as Tooum, contributing to the excellent CakePHP framework, and doing more work for ShermansTravel.
So this is my blog - my soap box! Here I attempt to share my likes, my dislikes, and my opinions. As well as providing some occasional respite from the daily crap we all endure. Enjoy ;)
Hey, if you want to reach me, i'm available via email:joel[at]developwithstyle[dot]com, and AIM:joelkmoss.
Leave a reply