Assume that I have the following tables:
-
book (title, year,)
-
category (title)
-
book_category (book_id, category_id) (M:M)
relations (Book model)
categories'=>array(self::MANY_MANY, 'Category',
' book_category (book_id, category_id)'),
);
A book may have many categories.
$book->categories returns all categories that a certain book has.
What I want to do is to find all books with a certain category, for example, with a category with id=1.
How do I perform such a query.