CActiveDataProvider's 'limit' criteria not working

Well, I’ve tried a lot but cannot get this piece of code working as expected.

Following is inside an action method,

$dataProvider=new CActiveDataProvider('Tips', array(

	'criteria'=>array('order'=>'create_time DESC','limit'=>1)


The order of the output is descending but ‘limit’? It just does not work. I’m expecting to get a single result after putting ‘limit’->1 and yet it gives me data from all the rows.

The view file corresponding to this contains,

<?php $this->widget('zii.widgets.CListView', array(




)); ?>

Really not able to understand what is going wrong here. Kindly help.

It will work only when you set the pagination to false in CActiveDataProvider


hi friends you can set limit by

	&#036;dataProvider=new CActiveDataProvider('model', array(


    		'order'=&gt;'create_time DESC',



			'pagination' =&gt; array('pageSize' =&gt; 8,),

			'totalItemCount' =&gt; 8,


its working nice.