I used CActiveDataProvider to retrieve all records from the "Product" table in the following manner:
[HTML]
$criteria = new CDbCriteria;
$criteria->select = array(‘id’,‘category’);
$criteria->distinct = true;
$dataProvider = new CActiveDataProvider(‘Product’, array(‘criteria’=>$criteria));
$resultSet = $dataProvider->getData();
[/HTML]
For some reason, it only seemed to read and return from the first few rows in the "Product" table. I got around this situation by using the findAll() method from CActiveRecord instead.
I still need to understand why it does not work with CActiveDataProvider’s getData() method.
CActiveDataProvider is mainly useful for list view components (CListView, CGridView). It therefore has a pagination object built in, which has a default pageSize of 10. If you really want all items in one go, you can change the pagesize like this:
new CActiveDataProvider('Product',array(
'criteria'=>$criteria,
'pagination'=>array(
'pageSize'=>1000, // or another reasonable high value...
),
));