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
-----------------------------
Maincategory model
-----------------------------
var $hasMany = array('Subcategory' )
-----------------------------
Recipe Model:
-----------------------------
var $belongsTo = array(
'User' => array(
var $hasAndBelongsToMany = array(
'Subcategory'=> array(
-----------------------------
Subcategory Model:
-----------------------------
var $belongsTo = array('Maincategory')
var $hasAndBelongsToMany = array(
'Recipe' => array(
into which Model I have to add the 'counterCache'=>true ?? I have
tried it with the HABTM so into recipe and subcategory model and than
used this:
http://bakery.cakephp.org/articles/view/counter-cache-behavior-for-ha...
Unfortunately this did not work. Of course I would like to have the
counter in the maincategory table, but is this so easy to reach if I
actualy don't save anything into this table when I add a new recipe?
How would counterCache be activated? Do I have to call it up in the
controller aswell?
Any advice will be great.
Luke