Skip to content
PHP Ecosystem
Explore

QueryRowDataProvider

API reference › Debug › models › search › QueryRowDataProvider

Sorts immutable query rows by their persisted fields without requiring public properties.

PropertyTypeDescriptionDefined by
$allModelsarrayThe data that is not paginated or sorted. Default: null.yii\data\ArrayDataProvider
$behaviors read-onlyarray<yii\base\Behavior<static>>List of behaviors attached to this component.yii\base\Component
$count read-onlyintThe number of data models in the current page.yii\data\BaseDataProvider
$idstring|nullAn ID that uniquely identifies the data provider among all data providers. Default: null.yii\data\BaseDataProvider
$keystring|array|callable|nullThe column that is used as the key of the data models. Default: null.yii\data\ArrayDataProvider
$keysarrayThe list of key values corresponding to $models.yii\data\BaseDataProvider
$modelClassstringThe name of the Model class that will be represented. Default: null. Available since 2.0.9.yii\data\ArrayDataProvider
$modelsarrayThe list of data models in the current page.yii\data\BaseDataProvider
$paginationarray|yii\data\Pagination|falseThe pagination to be used by this data provider.yii\data\BaseDataProvider
$sortarray|yii\data\Sort|boolThe sort definition to be used by this data provider.yii\data\BaseDataProvider
$totalCountintTotal number of possible data models.yii\data\BaseDataProvider
MethodDescriptionDefined by
__construct()Constructor.yii\base\BaseObject
__call()Calls the named method which is not a class method.yii\base\Component
__clone()This method is called after the object is created by cloning an existing one.yii\base\Component
__get()Returns the value of a component property.yii\base\Component
__isset()Checks if a property is set, i.e. defined and not null.yii\base\Component
__set()Sets the value of a component property.yii\base\Component
__unset()Sets a component property to be null.yii\base\Component
attachBehavior()Attaches a behavior to this component.yii\base\Component
attachBehaviors()Attaches a list of behaviors to the component.yii\base\Component
behaviors()Returns a list of behaviors that this component should behave as.yii\base\Component
canGetProperty()Returns a value indicating whether a property can be read.yii\base\Component
canSetProperty()Returns a value indicating whether a property can be set.yii\base\Component
className() staticReturns the fully qualified name of this class.yii\base\BaseObject
detachBehavior()Detaches a behavior from the component.yii\base\Component
detachBehaviors()Detaches all behaviors from the component.yii\base\Component
ensureBehaviors()Makes sure that the behaviors declared in behaviors() are attached to this component.yii\base\Component
getBehavior()Returns the named behavior object.yii\base\Component
getBehaviors()Returns all behaviors attached to this component.yii\base\Component
getCount()Returns the number of data models in the current page.yii\data\BaseDataProvider
getKeys()Returns the key values associated with the data models.yii\data\BaseDataProvider
getModels()Returns the data models in the current page.yii\data\BaseDataProvider
getPagination()Returns the pagination object used by this data provider.yii\data\BaseDataProvider
getSort()Returns the sorting object used by this data provider.yii\data\BaseDataProvider
getTotalCount()Returns the total number of data models.yii\data\BaseDataProvider
hasEventHandlers()Returns a value indicating whether there is any handler attached to the named event.yii\base\Component
hasMethod()Returns a value indicating whether a method is defined.yii\base\Component
hasProperty()Returns a value indicating whether a property is defined for this component.yii\base\Component
init()Initializes the object.yii\data\BaseDataProvider
off()Detaches an existing event handler from this component.yii\base\Component
on()Attaches an event handler to an event.yii\base\Component
prepare()Prepares the data models and keys.yii\data\BaseDataProvider
refresh()Refreshes the data provider.yii\data\BaseDataProvider
setKeys()Sets the key values associated with the data models.yii\data\BaseDataProvider
setModels()Sets the data models in the current page.yii\data\BaseDataProvider
setPagination()Sets the pagination for this data provider.yii\data\BaseDataProvider
setSort()Sets the sort definition for this data provider.yii\data\BaseDataProvider
setTotalCount()Sets the total number of data models.yii\data\BaseDataProvider
trigger()Triggers an event.yii\base\Component
prepareKeys() protectedPrepares the keys associated with the currently available data models.yii\data\ArrayDataProvider
prepareModels() protectedPrepares the data models that will be made available in the current page.yii\data\ArrayDataProvider
prepareTotalCount() protectedReturns a value indicating the total number of data models in this data provider.yii\data\ArrayDataProvider
sortModels() protectedOrders the captured statements by the active sort, keeping capture order as the tiebreaker.QueryRowDataProvider
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

ParameterTypeDescription
$modelsarray<array-key, mixed>Rows accepted by the base data provider.
$sortyii\data\SortActive field ordering.

Returns

array<array-key, mixed>: Sorted rows, preserving their original instances.