PHP 클래스 yii\data\BaseDataProvider

부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends yii\base\Component, implements yii\data\DataProviderInterface
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$id an ID that uniquely identifies the data provider among all data providers. You should set this property if the same page contains two or more different data providers. Otherwise, the [[pagination]] and [[sort]] may not work properly.

공개 메소드들

메소드 설명
getCount ( ) : integer Returns the number of data models in the current page.
getKeys ( ) : array Returns the key values associated with the data models.
getModels ( ) : array Returns the data models in the current page.
getPagination ( ) : Pagination | false Returns the pagination object used by this data provider.
getSort ( ) : Sort | boolean Returns the sorting object used by this data provider.
getTotalCount ( ) : integer Returns the total number of data models.
prepare ( boolean $forcePrepare = false ) Prepares the data models and keys.
refresh ( ) Refreshes the data provider.
setKeys ( array $keys ) Sets the key values associated with the data models.
setModels ( array $models ) Sets the data models in the current page.
setPagination ( array | Pagination | boolean $value ) Sets the pagination for this data provider.
setSort ( array | Sort | boolean $value ) Sets the sort definition for this data provider.
setTotalCount ( integer $value ) Sets the total number of data models.

보호된 메소드들

메소드 설명
prepareKeys ( array $models ) : array Prepares the keys associated with the currently available data models.
prepareModels ( ) : array Prepares the data models that will be made available in the current page.
prepareTotalCount ( ) : integer Returns a value indicating the total number of data models in this data provider.

메소드 상세

getCount() 공개 메소드

Returns the number of data models in the current page.
public getCount ( ) : integer
리턴 integer the number of data models in the current page.

getKeys() 공개 메소드

Returns the key values associated with the data models.
public getKeys ( ) : array
리턴 array the list of key values corresponding to [[models]]. Each data model in [[models]] is uniquely identified by the corresponding key value in this array.

getModels() 공개 메소드

Returns the data models in the current page.
public getModels ( ) : array
리턴 array the list of data models in the current page.

getPagination() 공개 메소드

Note that you should call BaseDataProvider::prepare or BaseDataProvider::getModels first to get correct values of [[Pagination::totalCount]] and [[Pagination::pageCount]].
public getPagination ( ) : Pagination | false
리턴 Pagination | false the pagination object. If this is false, it means the pagination is disabled.

getSort() 공개 메소드

Returns the sorting object used by this data provider.
public getSort ( ) : Sort | boolean
리턴 Sort | boolean the sorting object. If this is false, it means the sorting is disabled.

getTotalCount() 공개 메소드

When [[pagination]] is false, this returns the same value as [[count]]. Otherwise, it will call BaseDataProvider::prepareTotalCount to get the count.
public getTotalCount ( ) : integer
리턴 integer total number of possible data models.

prepare() 공개 메소드

This method will prepare the data models and keys that can be retrieved via BaseDataProvider::getModels and BaseDataProvider::getKeys. This method will be implicitly called by BaseDataProvider::getModels and BaseDataProvider::getKeys if it has not been called before.
public prepare ( boolean $forcePrepare = false )
$forcePrepare boolean whether to force data preparation even if it has been done before.

prepareKeys() 추상적인 보호된 메소드

Prepares the keys associated with the currently available data models.
abstract protected prepareKeys ( array $models ) : array
$models array the available data models
리턴 array the keys

prepareModels() 추상적인 보호된 메소드

Prepares the data models that will be made available in the current page.
abstract protected prepareModels ( ) : array
리턴 array the available data models

prepareTotalCount() 추상적인 보호된 메소드

Returns a value indicating the total number of data models in this data provider.
abstract protected prepareTotalCount ( ) : integer
리턴 integer total number of data models in this data provider.

refresh() 공개 메소드

After calling this method, if BaseDataProvider::getModels, BaseDataProvider::getKeys or BaseDataProvider::getTotalCount is called again, they will re-execute the query and return the latest data available.
public refresh ( )

setKeys() 공개 메소드

Sets the key values associated with the data models.
public setKeys ( array $keys )
$keys array the list of key values corresponding to [[models]].

setModels() 공개 메소드

Sets the data models in the current page.
public setModels ( array $models )
$models array the models in the current page

setPagination() 공개 메소드

Sets the pagination for this data provider.
public setPagination ( array | Pagination | boolean $value )
$value array | Pagination | boolean the pagination to be used by this data provider. This can be one of the following: - a configuration array for creating the pagination object. The "class" element defaults to 'yii\data\Pagination' - an instance of [[Pagination]] or its subclass - false, if pagination needs to be disabled.

setSort() 공개 메소드

Sets the sort definition for this data provider.
public setSort ( array | Sort | boolean $value )
$value array | Sort | boolean the sort definition to be used by this data provider. This can be one of the following: - a configuration array for creating the sort definition object. The "class" element defaults to 'yii\data\Sort' - an instance of [[Sort]] or its subclass - false, if sorting needs to be disabled.

setTotalCount() 공개 메소드

Sets the total number of data models.
public setTotalCount ( integer $value )
$value integer the total number of data models.

프로퍼티 상세

$id 공개적으로 프로퍼티

an ID that uniquely identifies the data provider among all data providers. You should set this property if the same page contains two or more different data providers. Otherwise, the [[pagination]] and [[sort]] may not work properly.
public $id