has and belongs to many - Cakephp hasAndBelongsToMany with countercache? -
anyone know how countercache working on habtm setup?
- categories ;id, name, test_count - tests ; id, name - test_to_categories ; test_id, category_id
use counter cache in join model (test_to_categories) through belongsto associations.
if not job you'll have implement custom counter method , call in aftersave() of model should count updated.
by way "test_to_categories" not following conventions. should categories_tests. conventions there reason. ;)
Comments
Post a Comment