Okay, so I just couldn't leave this alone :) I implemented the following, which works and even brings in the 'contain' info. However there is still a small problem...
// books_controller.php view() $similar = $this->Book->similar_books($genre_id, $limit); // model book.php $similarBooks = $this->find('all', array( 'recursive' => 1, 'joins' => array( array( 'table' => 'books_genres', 'alias' => 'BooksGenre', 'type' => 'inner', 'conditions'=> array('BooksGenre.book_id = Book.id') ), array( 'table' => 'genres', 'alias' => 'Genre', 'type' => 'inner', 'conditions'=> array( 'Genre.id = BooksGenre.genre_id', 'Genre.id' => $genre_id ) ) ), 'conditions'=> array('Genre.id' => $genre_id), 'contain' => array( 'Author' => array('fields' => array('Author.id', 'Author.slug')), 'Language' => array('fields' => array('Language.id', 'Language.name')), ), 'fields' => array('DISTINCT Book.id', 'Book.slug'), 'limit' => $limit, 'order' => 'RAND()', )); return $similarBooks; Although the above works when called from the books_controller.php, I also wanted to call this from authors view() page. // authors_controller.php view() $similar = $this->Author->Book->similar_books($genre_id, $limit); Everything works except it doesn't collect up the contain info for 'Author' or 'Language'. Does anyone have any ideas where I might be going wrong? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---