QueryRowDataProvider
API reference › Debug › models › search › QueryRowDataProvider
Sorts immutable query rows by their persisted fields without requiring public properties.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$allModels | array | The data that is not paginated or sorted. Default: null. | yii\ |
$behaviors read-only | array<yii\<static>> | List of behaviors attached to this component. | yii\ |
$count read-only | int | The number of data models in the current page. | yii\ |
$id | string| | An ID that uniquely identifies the data provider among all data providers. Default: null. | yii\ |
$key | string| | The column that is used as the key of the data models. Default: null. | yii\ |
$keys | array | The list of key values corresponding to $models. | yii\ |
$modelClass | string | The name of the Model class that will be represented. Default: null. Available since 2.0.9. | yii\ |
$models | array | The list of data models in the current page. | yii\ |
$pagination | array|yii\| | The pagination to be used by this data provider. | yii\ |
$sort | array|yii\| | The sort definition to be used by this data provider. | yii\ |
$totalCount | int | Total number of possible data models. | yii\ |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | yii\ |
__call() | Calls the named method which is not a class method. | yii\ |
__clone() | This method is called after the object is created by cloning an existing one. | yii\ |
__get() | Returns the value of a component property. | yii\ |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\ |
__set() | Sets the value of a component property. | yii\ |
__unset() | Sets a component property to be null. | yii\ |
attachBehavior() | Attaches a behavior to this component. | yii\ |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\ |
behaviors() | Returns a list of behaviors that this component should behave as. | yii\ |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\ |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\ |
className() static | Returns the fully qualified name of this class. | yii\ |
detachBehavior() | Detaches a behavior from the component. | yii\ |
detachBehaviors() | Detaches all behaviors from the component. | yii\ |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\ |
getBehavior() | Returns the named behavior object. | yii\ |
getBehaviors() | Returns all behaviors attached to this component. | yii\ |
getCount() | Returns the number of data models in the current page. | yii\ |
getKeys() | Returns the key values associated with the data models. | yii\ |
getModels() | Returns the data models in the current page. | yii\ |
getPagination() | Returns the pagination object used by this data provider. | yii\ |
getSort() | Returns the sorting object used by this data provider. | yii\ |
getTotalCount() | Returns the total number of data models. | yii\ |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\ |
hasMethod() | Returns a value indicating whether a method is defined. | yii\ |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\ |
init() | Initializes the object. | yii\ |
off() | Detaches an existing event handler from this component. | yii\ |
on() | Attaches an event handler to an event. | yii\ |
prepare() | Prepares the data models and keys. | yii\ |
refresh() | Refreshes the data provider. | yii\ |
setKeys() | Sets the key values associated with the data models. | yii\ |
setModels() | Sets the data models in the current page. | yii\ |
setPagination() | Sets the pagination for this data provider. | yii\ |
setSort() | Sets the sort definition for this data provider. | yii\ |
setTotalCount() | Sets the total number of data models. | yii\ |
trigger() | Triggers an event. | yii\ |
prepareKeys() protected | Prepares the keys associated with the currently available data models. | yii\ |
prepareModels() protected | Prepares the data models that will be made available in the current page. | yii\ |
prepareTotalCount() protected | Returns a value indicating the total number of data models in this data provider. | yii\ |
sortModels() protected | Orders the captured statements by the active sort, keeping capture order as the tiebreaker. | QueryRowDataProvider |
Method details
Section titled “Method details”sortModels()
Section titled “sortModels() ”protected function sortModels(array<array-key, mixed> $models, yii\data\Sort $sort): array<array-key, mixed>Orders the captured statements by the active sort, keeping capture order as the tiebreaker.
Parameters
| Parameter | Type | Description |
|---|---|---|
$models | array<array-key, | Rows accepted by the base data provider. |
$sort | yii\ | Active field ordering. |
Returns
array<array-key, mixed>: Sorted rows, preserving their original instances.