开发者

How to get n records from a Yii data provider?

开发者 https://www.devze.com 2023-03-26 10:14 出处:网络
I have a model which has the following relationship declared: \'messages\' => array(self::HAS_MANY, \'WallMessages\', \'liga_id\',

I have a model which has the following relationship declared:

'messages' => array(self::HAS_MANY, 'WallMessages', 'liga_id',
                'condition'=>'specific_post.parent_message_id IS NULL', 
                'order'=>'specific_post.date DESC', 
                'alias'=>'specific_post'),

Im trying to use this collection within a CListView with a custom pagination. However, if for example my pa开发者_运维知识库ges are of size 5, i need to get from elements 5 through 10 to populate the view.. How can i get n elements from a defined relationship?


you can use model's serach() or custom CDbCriteria yourself. CDbCriteria

0

精彩评论

暂无评论...
验证码 换一张
取 消