Hello all, i have 3 models => Photos,Tags and PhotosTag with relation like this : 1. Photo HasAndBelongsToMany Tag 2. Tag HasAndBelongsToMany Photo 3. Tag HasMany PhotosTag 4. PhotosTag belongsTo Tag.
I want count how many photos use this tag, so on Tag table, i'm create photos_tag_count. On PhotosTag Model : <?php class PhotosTag extends AppModel{ var $name = 'PhotosTag'; var $belongsTo = array( 'Tag'=>array('className'=>'Tag','counterCache'=>true) ); } ?> But every time i'm inserting new photo with same tags, photos_tag_count cannot update. i try creating a new coloumn like photo_tag_count, photos_tags_count but it doesn't work. Anyone can help me? said countercache works in belongsTo relation, but i face this problem. I have use HABTM with like http://www.cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1 but it's doesn't work on countercache. Anyone can help me how to countcache HABTM? Someone says, make updateCounterCache on beforeSave(), but i still don't know yet how to create it. Thanks --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---