One way is to use a counterCache method of storing number of products
in a category in the categories table. I've read that this is now
supported in cake core in 1.2, though I wrote my own approach a while
ago.
Adam
On Jul 21, 7:27 pm, bitkidoku <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> I have a question about using find() and retrieving some data.
> Let's say I have two models Product and Category. Product belongsTo
> Category, Category hasMany Product. I am using $this->Category->find('all');
> to retrieve every category and related products. But
>
> there are some categories that does not contain any products. I don't
> want to retrieve them. I can handle this on the view, but that doesn't
> feel right. Is there a way to achieve this on controller side?
>
> Thanks for your answers.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---