Here is example from guide
class User extends CActiveRecord
{
public function relations()
{
return array(
'posts'=>array(self::HAS_MANY, 'Post', 'authorID'
'order'=>'??.createTime DESC',
'with'=>'categories'),
'profile'=>array(self::HAS_ONE, 'Profile', 'ownerID'),
);
}
}
i'm trying to get the same result. i've news category, news list and authors. i select some category and i need to load all news with authors.
where i need to put authors relations? in news ar model?
here is my code:
category relations
'newslist'=>array(self::MANY_MANY, 'news', 'NewsCategory(categoryId, newsId)','with'=>'author')
news relations
'author'=>array(self::BELONGS_TO, 'Users', 'authorId')
but i get only selected category with news and without authors…
P.S.
sry for bad english ![]()