Tony Thomas

Father to two, husband to one, web developer and musician.


Posts Tagged ‘containable’


CakePHP: Containable Behavior is Your Friend

Thursday, February 18th, 2010

When it comes to optimizing your CakePHP queries, you need to abandon Recursive and adopt Containable.

In the example below I have the following models:

  • Patient
  • Specimen
  • Result
  • ResultType

The associations in the model are:

  • Result
    • belongsTo
      • ResultType
        • hasMany
          • Result
      • Patient
        • hasMany
          • Result
          • Specimen
      • Specimen
        • belongsTo
          • Patient
        • hasMany
          • Result

(more…)