Get the select query or fix size of result of my data provider

I have one problem, it’s a litle one.

It is my cActiveDataProvider!

$dataProvider = CActiveDataProvider(‘ForecClient’, array(

                'criteria' => array(

                    'alias' => 'client',

                    'condition' => 'client.fk_client = :client',

                    'params' =>  array(':client' => 10),

                    'together' => true,

                    'limit' => 0,

                    'offset' => 30,

                    'with' => array('clientFor', 'relActClient'),



i got results but i only got 4 rows, but i need 30, one code the offset is 30, anyone knows how to fix this?

other question, anyone knows how to get the query mounted on criteria("csbCriteria") object?

Not sure I understand your question…

but to clarify… if you have data from 1 to 34… and use offset 30… that means that you want data from 31-34… if you want the first 30 data… you would use limit 30 without offset…

I got 100 rows and i want to see the 30 firsts, i set the limit to 0 and offset to 30, but i got 4 rows instead 30, understand?

As I wrote before… to get the 30 first… you need to use limit 30, offset 0 or not used…

You don’t need limit. Use CActiveDataProvider pagination parameter.


Its going to do all the pages for you.

do you mean

$csbCriteria = new CDbCriteria();

$csbCriteria->alias = 'client';


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



If you do then you can :)

But the real problem occur when i set the ‘together’ => true.

i change the query to show my problem, but i forgot the clause "group" , and this clause i pass one field of "clientFor", and at this point i got the error, because the crieteria dont make the join.

i saw on forum one response of by quian…

use the ‘together’ => true

i use the "together" and i got the response 4 rows, but i pass limit 0 and offset 30, is to get 30 rows right?

limit 0,30 is the first 30 rows.