Re: findall on 3 models chained with belongsto

2007-11-06 Thread AD7six
On Nov 5, 4:33 pm, Claudia [EMAIL PROTECTED] wrote: Hi there I have three models that are chained with belongsTo in one direction and hasMany in the other direction: Model1 belongsTo Model2 belongsTo Model3 and Model3 hasMany Model2 hasMany Model1 Now I need to query model1 and also

Re: findall on 3 models chained with belongsto

2007-11-06 Thread Claudia
Hi there Thanks for your answers. I am not that worried about the number of queries although the 20 was just an example. Although on the index page of my website I would have around 200 extra queries which (during testing) sometimes causes a page delay of about half a second - not a huge

Re: findall on 3 models chained with belongsto

2007-11-06 Thread AD7six
On Nov 6, 4:01 pm, Claudia [EMAIL PROTECTED] wrote: Hi there Thanks for your answers. I am not that worried about the number of queries although the 20 was just an example. Although on the index page of my website I would have around 200 extra queries which (during testing) sometimes

findall on 3 models chained with belongsto

2007-11-05 Thread Claudia
Hi there I have three models that are chained with belongsTo in one direction and hasMany in the other direction: Model1 belongsTo Model2 belongsTo Model3 and Model3 hasMany Model2 hasMany Model1 Now I need to query model1 and also get the related data from model2 and model3 which can be easily

Re: findall on 3 models chained with belongsto

2007-11-05 Thread [EMAIL PROTECTED]
As for first part of question, look at very nice behavior http://www.thinkingphp.org/2007/06/14/containable-20-beta/ . A solution for pagination in the comments. ;-) But as for the second part, I don't know any solution to reduce a number of queries :-( Very dirty hack to reduce amount of

Re: findall on 3 models chained with belongsto

2007-11-05 Thread Martin Schapendonk
On 11/5/07, Claudia [EMAIL PROTECTED] wrote: b) The query is really inefficient: Example: If the first query returns 10 results we need 21 queries for in total (the join query and then 10 queries each for model2 and model3). We could get the same result by having only one query which uses a