Re: Count RS for element

2009-07-06 Thread Luke
Hi, I just had a look at the CounterCache, but seem to struggle on the implementation. I added another field to my maincategories table: recipes_count I suppose I have to add now 'counterCache'=>true to my Maincategory model, my relationships are currently looking like this

Re: Count RS for element

2009-07-04 Thread bramu...@gmail.com
I am new to Cake PHP but I can give you the sql to get the count select count(*), maincategory from maincategories mc, subcategories sc, recipes_subcategories rsc where mc.id = sc.maincategory_id AND sc.id = rsc.subcategory_id AND mc.id = $this->params["category_id"] group by mc.id Thanks, Ram

Re: Count RS for element

2009-07-03 Thread Brendon Kozlowski (Realm)
You'd probably want to take a look at CounterCache in the book; this would require a modification (an additional field) to your maincategories table, and a little bit of code, but would ultimately be quicker than a separate query. Another suggestion would be to look at find('count') if you don't

Count RS for element

2009-07-03 Thread Luke
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. Eve