Model()->Findall() With Many_Many-Relation

assume the following tables:

category (id, name)

book (id, categoryId, title)

author (id, firstname, lastname)

book_author (bookId, authorId) //MANY-MANY-Relation between book and author

is it possible to select all authors of a certain category the active record way? Author::model()->findAllByCategory($name)?


In Author’s model add this new method method:

    public function findAllByCategory($name)





            'join'=>'INNER JOIN book_author ON book_author.authorId = INNER JOIN = book_author.bookId INNER JOIN = book.categoryId',

            'group' => ''


        return $this;