How to iterate over a dataprovider object? I want to access the \'name\' field of each row returned and build a list. Can you help?
Table structure for table
With the solution of @ben-rowe you are querying all the rows at once. You can have memory issues.
With the following solution you will fetch the categories from ten by ten (the default CPagination.pageSize value):
$dataProvider = new CActiveDataProvider('Categories', array(
'pagination' => array(
'validateCurrentPage' => false
),
));
$pagination = $dataProvider->pagination;
while ($categories = $dataProvider->getData(true)){
foreach ($categories as $category) {
//...
}
$pagination->currentPage++;
}