Issue With Pagination In Dataprovider

hello i am creating a search module which is taking data from apis…

Now i am getting all result in 1 api call and i am making it as a dataProvider.

this is the code…

$dataProvider = new CArrayDataProvider($result, array(		

							'sort' => array(

							'attributes' => array('name',



							'pagination' => array(

								'pageSize' => 10,



this is working fine and giving pagination. What i want to do is to use limit and ofset of api.

for eg consider the yelp api"xxx"&location="xxx"&limit=10&ofset=0;

i want to get only 10 result initially and i need another api call to get next set when i click the pagination [2] or next >.

how can this be done ?


Unfortunately, CArrayDataProvider requires raw data that is not sorted or paginated.

The sorting is performed on the array of raw data. And the pagination is performed by slicing the array of the sorted raw data. We can not give the optimized raw data to it by processing the sorting and pagination by ourselves … which we can easily do with CActiveDataProvider or CSqlDataProvider where the sorting is converted to ‘ORDER’ and the pagination to ‘OFFSET’ and ‘LIMIT’.

I would rather want to make a custom data provider derived from CArrayDataProvider (or CDataProvider) which performs the pagination by utilizing the yelp api.

Hi Mahesh,

Can you please give me idea/sample how you setup Yelp on your project. I am struggling to configure Yelp in my project.

Thanks in advance,