strange counter cache behavior - is this supposed to be like that?

2008-05-14 Thread MarcS
I came accross an issue with the built in counter cache. My cake version is 1.2.0.6311 The query generated by cake to update the counter uses joins. Suppose I have a model 'foo' which which has many 'dependent 'foo' itself belongs to 'bar' which has many 'foo' The query to update the counter

Re: strange counter cache behavior - is this supposed to be like that?

2008-05-14 Thread Chris Hartjes
On Wed, May 14, 2008 at 4:04 PM, MarcS [EMAIL PROTECTED] wrote: UPDATE foos as foo LEFT JOIN 'bars' as 'bar' ON ('foo'.bar_id = bar.id) SET foo.dependent_count = 99 WHERE foo.id=1 Why does it do that? I can't see the point in creating this join. It serves no purpose whatsoever. Well, do

Re: strange counter cache behavior - is this supposed to be like that?

2008-05-14 Thread MarcS
yes there is one 'foo' itself belongs to 'bar' which has many 'foo' I understand that it is this association which is causing the join. But I don't understand why that join is required. Isn't all the counter cache is supposed to do is update foo.dependent_count What does it need the join for

Re: strange counter cache behavior - is this supposed to be like that?

2008-05-14 Thread Chris Hartjes
On Wed, May 14, 2008 at 4:13 PM, MarcS [EMAIL PROTECTED] wrote: I understand that it is this association which is causing the join. But I don't understand why that join is required. Isn't all the counter cache is supposed to do is update foo.dependent_count What does it need the join for

Re: strange counter cache behavior - is this supposed to be like that?

2008-05-14 Thread Marc Schuetze
will do that. Before submitting a ticket I was gonna ask if there is a purpose in this that I don't understand. I'm still fairly new to cake and I just wanted to be sure thanks for your answer. On Wed, May 14, 2008 at 9:17 PM, Chris Hartjes [EMAIL PROTECTED] wrote: On Wed, May 14, 2008 at

Re: strange counter cache behavior - is this supposed to be like that?

2008-05-14 Thread Chris Hartjes
On Wed, May 14, 2008 at 4:19 PM, Marc Schuetze [EMAIL PROTECTED] wrote: will do that. Before submitting a ticket I was gonna ask if there is a purpose in this that I don't understand. I'm still fairly new to cake and I just wanted to be sure The worst thing that will happen if you file a

Re: strange counter cache behavior - is this supposed to be like that?

2008-05-14 Thread Dr. Tarique Sani
On Thu, May 15, 2008 at 1:51 AM, Chris Hartjes [EMAIL PROTECTED] wrote: The worst thing that will happen if you file a ticket is that it will be rejected along with an explanation. There might be a snarky comment associated with it, but that's it. Corollary to the above - Don a bit of