eager loading with criteria

Hi!

I have 2 tables: User, Status. Status belongs to User with user_id, so an user has many statuses. When I want find eagerly a user with his/her statuses with some limitation, the generated sql doesnt contain the LIMIT.

Example:




$c = new CDbCriteria;

$c->condition	= 'username=:username';

$c->params		= array(

	':username' => $username

);

$model = User::model()->with(array(

	'Statuses' => array(

		'limit'		=> self::PAGE_SIZE,

		'offset'	=> $page * self::PAGE_SIZE

	)

	))->find($c);

$this->render(

	'index',array(

        	'model'	        => $model,

		'statuses'	=> $model->Statuses

	)

);



Generated SQL:




SELECT `User`.`id` AS `t0_c0`, `User`.`username` AS `t0_c1`,

`User`.`name` AS `t0_c2`, `User`.`location` AS `t0_c3`,

`User`.`description` AS `t0_c4`, `User`.`image` AS `t0_c5`, `User`.`url` AS

`t0_c6`, `User`.`update` AS `t0_c7`, `Statuses`.`user_id` AS `t1_c0`,

`Statuses`.`id` AS `t1_c1`, `Statuses`.`banned` AS `t1_c2`,

`Statuses`.`pubdate` AS `t1_c3`, `Statuses`.`description` AS `t1_c4` FROM

`User`  LEFT OUTER JOIN `Status` `Statuses` ON

(`Statuses`.`user_id`=`User`.`id`) WHERE (username=:username) AND

(banned=0) ORDER BY Statuses.id DESC



(Order and banned = 0 condition defined in the model)

Is it a bug, or I have to use lazy loading?

first load the user, then his statuses


$statuses = Status::model()->ofUser($user->id)->findAll($criteria)

or without a criteria


$statuses = Status::model()->ofUser($user->id)->limit($offset, $limit)->findAll()

thx!