Tagged with PHP

PHP programming

Anatomy of a CakePHP Test Case

With all the talk of testing going on, I thought it would be good to look at how tests work and what is makes them tick. SimpleTest handles the bulk of test case execution, however, there are a few CakePHP specifics that are not part of a normal SimpleTest::UnitTestCase.

Session debugging in CakePHP

Often on IRC and the CakePHP google group, I hear people asking how to get values out of the Session or how to find out what is currently in the Session. Generally this is connected to AuthComponent, which is can be complicated component. However, some simple ‘crude’ PHP tactics can make the “whats’s in my session?” question very simple.

Quick and dirty 'Down for Maintenance' page with CakePHP

Websites need maintenance, and sometimes that maintenance requires the site to go down for a little bit as you tweak the database, add additional capacity or make large changes to the application code. In these circumstances you cannot afford to have users mucking about on your application. However, you might need access to ensure all your amazing upgrades go smoothly or perhaps do the upgrading inside the application itself.

Auth and ACL an end to end tutorial pt. 1

Now, there are many tutorials out there for Auth and ACL in CakePHP. However, none of them (as far as I know of) cover putting together Auth and ACL from beginning to end. That is what I’m going to do in this article. I am splitting the article into two parts; the first about setting up our app and getting the Aros running, the second on building Acos and putting it all together.

More dogfood

Well I just got back from a wonderful 2 week vacation of europe. My wife and I went to Amsterdam, Rome and Paris, for an art-geekout. We went to every museum we could and saw tons of beautiful works that really need to be seen in the stone and paint. We took tons of photos and I hopefully will find the time to do some painting based on them in the upcoming months.

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.

PHP's isset() and arrays

Earlier this week I learned that isset() behaves a little differently than I had expected when dealing with arrays. Now I already knew that isset() would return false on a variable not existing, or being set to null. However, I was not expecting it to return false on an array key existing and being set to null.

Hacking the Form Helper and Editing Multiple Rows with CakePHP 1.1

CakePHP 1.2 is a fantastic improvement over 1.1. However like many, my work has a stable release only policy. So I’m stuck using 1.1 at work for the time being. But after drinking the 1.2 juice, 1.1 is missing some of the potent automagic flavours. First up editing multiple rows in models. The stock syntax is lacking in that it doesn’t support this at all.

Understanding MVC and CakePHP

Continuing with the trend of CakePHP information here, I’m going to cover some of the acronyms and lexicon of CakePHP. I hang out a lot on #cakephp and there are repeating trends in some of the questions that get asked so hopefully I can answer some of those questions here. As well as provide a bit of my personal experiences.

Fancy routing examples with CakePHP 1.2

Routing in CakePHP is quite flexible in how you can route your urls to your controllers and actions. Offering both variable replacement and regex routing. You can route almost any parameter that is set by dispatcher and more. So lets try a few of these.