I have these models: * Artist * Artwork * Category with these associations: * Artist hasMany Artworks * Category hasMany Artworks * Artwork belongsTo Artist, Artwork belongsTo Category
Now, given a Category, I need to paginate through the Artists that have at least one Artwork that belongs to that Category. I thought that I can create a HBTM association between Artist and Category using Artwork as the join table. It works well when I just need to catch all Categories of a given Artist simply using $artist = $this->Artist->find( 'first', array( 'conditions' => array('Artist.slug' => $slug), 'contain' => array('Category') ) ); I found this tutorial (http://cakebaker.42dh.com/2007/10/17/pagination- of-data-from-a-habtm-relationship/) about how to paginate a HBTM relation and it works well except one thing. My association isn't a real HBTM association because the Artist table contains more than one record for each object on both sides. In fact it is likely that an Artist has many Artworks in the same Category. Using the method of the tutorial, in the result, each Artist is repeated once for every Artwork it has in the given Category. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---