I have articles and categories in a n:m relation:
I looking for a find statement on the Category Model so that I can get all categories witch consist at least one article.
Should be easy, but I didn’t find a efficient solution, without searching retrieving all the articles.
Thanks,
Maechi
I think that counter cache is your friend here. Take a look here.
You can add the counter cache to the
categoriestable and in the CategoryArticles you do likeSo you can find your Category with