O'Reilly logo

CakePHP 1.3 Application Development Cookbook by Mariano Iglesias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building queries with ad-hoc JOINs

CakePHP has a very easy way to handle bindings, and through the use of the Containable behavior, as shown in several recipes in Chapter 2, Model Bindings, we have a lot of flexibility when dealing with bindings.

However, there are times where we need to fall outside of a normal find operation and perform queries that join several models, without using normal binding operations, to save us some valuable queries. In this recipe, we will see how to specify JOIN operations when performing a find on a model.

Getting ready

We need some sample models and data to work with. Follow the Getting ready section of the recipe, Performing GROUP and COUNT queries.

To illustrate the difference between normal binding operations and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required