public function relations()
{
return array(
'author'=>array(self::BELONGS_TO, 'User', 'authorId'),
'comments'=>array(self::HAS_MANY, 'Comment', 'postId', 'order'=>'??.createTime'),
'tagFilter'=>array(self::MANY_MANY, 'Tag', 'PostTag(postId, tagId)',
'together'=>true,
'joinType'=>'INNER JOIN',
'condition'=>'??.name=:tag'),
);
}
This works very well in Yii 1.0. It retrieves all posts with specific tag by using an eager loading.
However, in Yii 1.1, it doesn't work (of course I changed ?? to tagFilter). Whenever I set limit in $criteria, the following code
$withOption['tagFilter']['params'][':tag']=$_GET['tag']; .... $pages=new CPagination($postCount); $pages->pageSize=Yii::app()->params['postsPerPage']; $pages->applyLimit($criteria); $posts=Post::model()->with($withOption)->findAll($criteria);
returns all post because it doesn't perform an eager loading anymore!
Is this a bug in Yii 1.1 or this method is just removed from Yii 1.1?
(In blog example of Yii 1.1, the many to many relationship is not used anymore, so we don't see the problem).
Currently, I have to work around by declaring 'join' and 'where' property for $criteria to do INNER JOIN to PostTag and Tag tables, but I hope there is a more robust way to get the same result.

Help













