Re: Duplicate Queries in MODEL-HABTM-HABTM-HasMany relationship

2010-06-09 Thread LunarDraco
I agree with John, And I would personally use a join query in this type of situation. Your most likely not going to need all of the data that comes back from normal cake binding. And normal cake binding is going to perform multiple queries to obtain the data (this is not a bad thing, but it does

Re: Duplicate Queries in MODEL-HABTM-HABTM-HasMany relationship

2010-06-09 Thread pinker42
Hi, first of all thank you for your long and detailed answer. I'm aware of both methods John mentioned. So neither the containable behaviour nor the forced join solution are new to me, and i already used both techniques in the past with success. But my problem is a bit more complicated: First of

Duplicate Queries in MODEL-HABTM-HABTM-HasMany relationship

2010-06-08 Thread pinker42
Hi, i urgently need some help with a really nasty problem. I have 4 main tables A,B,C,D and two join tables AB, BC joined: A (1 record) - (HABTM AB) B (13 records) - (HABTM BC) C (131 records) - (hasMany) D (405 records). When i fetch the data with A-find('All') cake does a good job for A,B and

Re: Duplicate Queries in MODEL-HABTM-HABTM-HasMany relationship

2010-06-08 Thread John Andersen
This is a frequent topic, retrieving data from models over several levels of association. The current answers nearly always are: 1) Look into using the Containable behavior, see: http://book.cakephp.org/view/1323/Containable 2) Look into using joins, see: