Friday, July 3, 2009

Count RS for element

Hi,

I have the following issue where I am a bit stuck. I have 3 tables

maincategories
- id
- maincategory

subcategories
- id
- subcategory
- maincategory_id

recipes_subcategories
- id
- recipe_id
- subcategory_id

The Maincategories are shown as a Navigation. I created an element for
this. Everything works fine. The next step I would like to achieve is
to count the amount of recipes for each maincategory.

Right now I use this code in my maincategories_controller:

if(isset($this->params['requested'])) {
return $this->Maincategory->find('all', array('order'=>array
('Maincategory'=>'asc'), 'recursive' => 0));
}

How do I get the amount of recipes shown with my above Database
struktur? Could someone give me a hint? I am pretty stuck with it and
can't think of a solution. Thank you very much in advance.

Regards Luke

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: