Friday, March 25, 2011

Re: how to use counterquery in cakephp

Thank you Jeremy.

Would you give me a bit more details?

some example code perhaps?


On Mar 25, 8:06 pm, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> I think you'll need to write your own custom function for that and put in the afterSave callback of the 'Wheel' model.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 25 Mar 2011, at 11:39, Zeu5 wrote:
>
>
>
>
>
>
>
> > Hi
>
> > i need help understanding counterquery
>
> > i know right now cakephp allows me to store children count in parent
> > table
>
> > eg a Car hasMany Wheel
>
> > so in cars table, there is a wheels_count column.
>
> > but i only want to store the wheel associated with a particular car
> > AND has a status as 'active'.
>
> > Meaning, if 5 Wheel records belong to a Car with id = 17, but of these
> > 5 only 3 of them have a Wheel.status = 'active', then the
> > Car.wheels_count for id 17 is 3.
>
> > so apparently counterquery helps me to do this?
>
> > Please enlighten me.
>
> > Thank you.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: