Class CDataProviderIterator
CDataProviderIterator allows iteration over large data sets without holding the entire set in memory.
CDataProviderIterator iterates over the results of a data provider, starting
at the first page of results and ending at the last page. It is usually only
suited for use with CActiveDataProvider.
For example, the following code will iterate over all registered users (active record class User) without running out of memory, even if there are millions of users in the database.
$dataProvider = new CActiveDataProvider("User");
$iterator = new CDataProviderIterator($dataProvider);
foreach($iterator as $user) {
echo $user->name."\n";
}
- CComponent
-
CDataProviderIterator
implements
Iterator,
Countable
Package: system\web
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Charles Pick <charles.pick@gmail.com>
Author: Carsten Brandt <mail@cebe.cc>
Since: 1.1.13
Located at x2engine/framework/web/CDataProviderIterator.php
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Charles Pick <charles.pick@gmail.com>
Author: Carsten Brandt <mail@cebe.cc>
Since: 1.1.13
Located at x2engine/framework/web/CDataProviderIterator.php
public
|
|
public
|
|
public
integer
|
|
protected
array
|
|
public
mixed
|
|
public
integer
|
|
public
|
|
public
|
|
public
boolean
|
|
public
integer
|
public
|
$dataProvider |
#
the data provider to iterate over |
public
integer
|
$totalItemCount |
#
the total number of items in the iterator |