zen of coding

notEmpty validation rule

With the recent changeset (https://trac.cakephp.org/changeset/7399) a new, ‘notEmpty’, validation rule is now available. As you can guess, it checks to make sure that a field contains something other than a white space. You will have to upgrade to the latest build, to ensure that this rule is available in your[…]

Read More »

Displaying sort direction in paginated data

Just a little tip on styling your table with paginated data… Wouldn’t it be nice to show to the user what column and direction is currently used for sorting of your data? Here’s how you can do that with a little CSS and some Paginator methods. First, we need to[…]

Read More »

Forcing an SQL JOIN in CakePHP

Update (10/7/2009)… this functionality has been rolled into Habtamable behavior You’ve probably noticed that by default CakePHP will only create a JOIN query if you have a hasOne or belongsTo associations between your models. There are cases, however, when a JOIN is necessary to get just the right data. So[…]

Read More »

LEFT JOIN vs INNER JOIN

By default, if you have a hasOne or belongsTo relationship between models, CakePHP will build a JOIN query using LEFT JOIN. In some cases, however, you would really prefer to do an INNER JOIN instead. This is easily accomplished by specifying the ‘type’ key in your association. So, for example,[…]

Read More »

Notes on CakePHP HABTM (Part 2, saving data)

If you haven’t read part 1, where I cover some HABTM basics, you should probably take a look at that article as well. Part 2. Saving data The next topic I wanted to cover is how to go about saving the HABTM data. Actually it is really not that complicated,[…]

Read More »

Notes on CakePHP HABTM (Part 1, the basics)

Part 1. The basics HABTM seems to give a lot of people trouble, so I wanted to cover a few points that may or may not be in the manual. And I will assume here that you have basic understanding or some knowledge of HABTM, otherwise you should really go[…]

Read More »

What can we learn from CakePHP tests?

Update: Currently the API for test cases searches is down (but coming back soon). Remember, that you still have the test cases in the core of cake, so you can and should utilize them all the time ;) (If anyone wishes to volunteer their time to help out to bring[…]

Read More »
%d bloggers like this: