zen of coding

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 »


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 »
%d bloggers like this: