Here is a simplified example of how I usually build the data (in case I've been doing it wrong):
$query = 'SELECT pid, last_name, first_name, address FROM people ORDER BY last_name, first_name;'; $cmd = Yii::app()->createCommand($query); $result = $cmd->query(); $data = array(); foreach($result as $row) $data = array('pid'=>$row['pid'], 'last_name'=>$row['last_name'], 'first_name'=>$row['first_name'], 'address'=>$row['address']); $dp = return new CArrayDataProvider($data, 'id'=>'pid',- array( 'pagination'=>array('pageSize'=>10), ));
Outside the world of Yii I would generally just use limits + offsets but I don't see how I can do that with CArrayDataProvider. Is there a way to do this? If not is there another dataprovider class that I could use? I'm willing to extend my own dataprovider if need be but I obviously if there is a standard way of doing this that would be ideal.