Interface yii\data\DataProviderInterface
Implemented by | yii\data\ActiveDataProvider, yii\data\ArrayDataProvider, yii\data\BaseDataProvider, yii\data\SqlDataProvider |
---|---|
Available since version | 2.0 |
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/data/DataProviderInterface.php |
DataProviderInterface is the interface that must be implemented by data provider classes.
Data providers are components that sort and paginate data, and provide them to widgets such as yii\grid\GridView, yii\widgets\ListView.
For more details and usage information on DataProviderInterface, see the guide article on data providers.
Public Methods
Method | Description | Defined By |
---|---|---|
getCount() | Returns the number of data models in the current page. | yii\data\DataProviderInterface |
getKeys() | Returns the key values associated with the data models. | yii\data\DataProviderInterface |
getModels() | Returns the data models in the current page. | yii\data\DataProviderInterface |
getPagination() | yii\data\DataProviderInterface | |
getSort() | yii\data\DataProviderInterface | |
getTotalCount() | Returns the total number of data models. | yii\data\DataProviderInterface |
prepare() | Prepares the data models and keys. | yii\data\DataProviderInterface |
Method Details
Returns the number of data models in the current page.
This is equivalent to count($provider->getModels())
.
When pagination is false, this is the same as totalCount.
public abstract integer getCount ( ) | ||
return | integer |
The number of data models in the current page. |
---|
public function getCount();
Returns the key values associated with the data models.
public abstract array getKeys ( ) | ||
return | 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. |
---|
public function getKeys();
Returns the data models in the current page.
public abstract array getModels ( ) | ||
return | array |
The list of data models in the current page. |
---|
public function getModels();
public abstract yii\data\Pagination|false getPagination ( ) | ||
return | yii\data\Pagination|false |
The pagination object. If this is false, it means the pagination is disabled. |
---|
public function getPagination();
public abstract yii\data\Sort|false getSort ( ) | ||
return | yii\data\Sort|false |
The sorting object. If this is false, it means the sorting is disabled. |
---|
public function getSort();
Returns the total number of data models.
When pagination is false, this is the same as count.
public abstract integer getTotalCount ( ) | ||
return | integer |
Total number of possible data models. |
---|
public function getTotalCount();
Prepares the data models and keys.
This method will prepare the data models and keys that can be retrieved via getModels() and getKeys().
This method will be implicitly called by getModels() and getKeys() if it has not been called before.
public abstract void prepare ( $forcePrepare = false ) | ||
$forcePrepare | boolean |
Whether to force data preparation even if it has been done before. |
public function prepare($forcePrepare = false);
Signup or Login in order to comment.