http://book.cakephp.org/view/75/Saving-Your-Data#counterCache-Cache-your-count-490
book.cakephp.org search feature is useless. There is whole chapter
about "counterCache" but no search results ?!
On Sep 21, 6:41 pm, ORCC <[EMAIL PROTECTED]> wrote:
> I have a Manufacturer model having many Products. In order to return
> the number of Products of a Manufacturer I wrote the following method
> in Manufacturer:
>
> function countProducts() {
> App::import('Model','Product');
> $condition = Array('manufacturer_id' => $this->id)
> return $this->Product->find('count',Array('conditions' =>
> $condition));
>
> }
>
> I would like to know if there is some way of getting the count of
> associated records without importing the associated model, but
> performing a recursive count.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---