Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionFormModelBase
  • CActiveDataProvider
  • CalendarEventFormModel
  • CallFormModel
  • CArrayDataProvider
  • CAssetManager
  • CBaseController
  • CBaseUrlRule
  • CCacheHttpSession
  • CClientScript
  • CController
  • CCookieCollection
  • CDataProvider
  • CDataProviderIterator
  • CDbHttpSession
  • CExtController
  • CFormModel
  • CHttpCookie
  • CHttpRequest
  • CHttpSession
  • CHttpSessionIterator
  • COutputEvent
  • CPagination
  • CreatePageFormModel
  • CSort
  • CSqlDataProvider
  • CTheme
  • CThemeManager
  • CUploadedFile
  • CUrlManager
  • CUrlRule
  • CWebApplication
  • CWebModule
  • CWidgetFactory
  • EditMobileFormsFormModel
  • EventCommentPublisherFormModel
  • EventFormModel
  • EventPublisherFormModel
  • FileSystemObjectDataProvider
  • MassActionFormModel
  • MobilePagination
  • NoteFormModel
  • NotificationsController
  • TimeFormModel
  • UploadLogoFormModel
  • X2FormModel
  • X2HttpRequest

Interfaces

  • IDataProvider
  • IWidgetFactory
  • Overview
  • Package
  • Class
  • Tree

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
Extended by 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
Methods summary
public
# __construct( CDataProvider $dataProvider, integer $pageSize = null )

Constructor.

Constructor.

Parameters

$dataProvider
CDataProvider
$dataProvider the data provider to iterate over
$pageSize
integer
$pageSize pageSize to use for iteration. This is the number of objects loaded into memory at the same time.
public CDataProvider
# getDataProvider( )

Returns the data provider to iterate over

Returns the data provider to iterate over

Returns

CDataProvider
the data provider to iterate over
public integer
# getTotalItemCount( )

Gets the total number of items to iterate over

Gets the total number of items to iterate over

Returns

integer
the total number of items to iterate over
protected array
# loadPage( )

Loads a page of items

Loads a page of items

Returns

array
the items from the next page of results
public mixed
# current( )

Gets the current item in the list. This method is required by the Iterator interface.

Gets the current item in the list. This method is required by the Iterator interface.

Returns

mixed
the current item in the list

Implementation of

Iterator::current()
public integer
# key( )

Gets the key of the current item. This method is required by the Iterator interface.

Gets the key of the current item. This method is required by the Iterator interface.

Returns

integer
the key of the current item

Implementation of

Iterator::key()
public
# next( )

Moves the pointer to the next item in the list. This method is required by the Iterator interface.

Moves the pointer to the next item in the list. This method is required by the Iterator interface.

Implementation of

Iterator::next()
public
# rewind( )

Rewinds the iterator to the start of the list. This method is required by the Iterator interface.

Rewinds the iterator to the start of the list. This method is required by the Iterator interface.

Implementation of

Iterator::rewind()
public boolean
# valid( )

Checks if the current position is valid or not. This method is required by the Iterator interface.

Checks if the current position is valid or not. This method is required by the Iterator interface.

Returns

boolean
true if this index is valid

Implementation of

Iterator::valid()
public integer
# count( )

Gets the total number of items in the dataProvider. This method is required by the Countable interface.

Gets the total number of items in the dataProvider. This method is required by the Countable interface.

Returns

integer
the total number of items

Implementation of

Countable::count()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Magic properties summary
public CDataProvider $dataProvider
#

the data provider to iterate over

the data provider to iterate over

public integer $totalItemCount
#

the total number of items in the iterator

the total number of items in the iterator

API documentation generated by ApiGen 2.8.0