Hi,
I need to filter a categories list by showing only the ones with at least one post.
I’ve created the STAT relation to get the post count :
'postCount'=>array(self::STAT, 'Post', 'category_id'),
and than the named-scope :
public function scopes() {
return array(
'nonempty'=>array
(
'with'=>'postCount',
'condition'=>'postCount>0',
)
);
}
but that obviously don’t work.
How can I accomplish that without iterating all the elements ? I’ve searched on the forum but I can’t find anything.
Thanks.