My question is, if want to get the articles by category id, how to do it and need the pagination. I use $criteria = new CDbCriteria(); to generate pagination
$criteria = new CDbCriteria;
$criteria->join = 'LEFT JOIN article_category ac ON id = ac.article_id AND ac.category_id = :categoryId';
$criteria->params = array(':categoryId' => $categoryId);
or something along those lines. (You’ll still need to make the other relevant SQL statements and disambiguate the table names as required).
Sorry shouldn’t write code when tired, of course the condition needed to be in a where clause.
There is probably an ORM way but it’s not really the “right way” here because you don’t need to access the other record’s data. If you really wanted to you could use ::with()