Advertisement
Guest User

Many_many

a guest
Jun 20th, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class PostPage extends Page {
  2. public static $many_many = array(
  3. 'Authors' => 'AuthorPage'
  4. );
  5. }
  6.  
  7. class AuthorPage extends Page {
  8. public static $belongs_many_many = array(
  9. 'Posts' => 'PostPage'
  10. );
  11. }
  12.  
  13. class HomePage_Controller extends Page_Controller {
  14.  
  15. public function filterStuff() {
  16. $results = PostPage::get()->filter(array('Authors.ID:ExactMatch' => 37));
  17. return $results->renderWith('SomeTemplate');
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement