I'm using the containable behavior to grab some data. I have a News
Category model the hasAndBelongsToMany News. This way I can associate
a news article with many different news categories. So I'm wanting to
grab all of the news categories with a limited number of news articles
for each. So this is what I tried.
$newsItems = $this->NewsCategory->find('all', array(
'conditions' => array('id <>' => 7),
'order' => 'sort_order',
'contain' => array(
'News' => array(
'conditions' => array('News.deleted' =>
0),
'order' => 'News.created DESC',
'limit' => 3
)
)
));
However the results I get is a limit of 3 news articles all together
rather than 3 per news category. Is there way to get the results I
want using containable. The only other thing I can think to do is
write on own method inside my model to limit only three articles per
news category.
Ideas or Suggestions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---