QueryBatcher
- Type
- Class
- Namespace
- craft\db
- Inherits
- craft\db\QueryBatcher
- Implements
- craft\base\Batchable
- Since
- 4.4.0
QueryBatcher provides a craft\base\Batchable wrapper for a given yii\db\QueryInterface (opens new window) object.
View source (opens new window)
# Public Methods
Method | Description |
---|---|
__construct() | Constructor |
count() | |
getSlice() | Returns a slice of the items |
# __construct()
Constructor
WARNING
The query should have orderBy
(opens new window) set on it, ideally to the table’s primary key
column. That will ensure that the rows returned in result batches are consecutive.
View source (opens new window)
Arguments
$query
(yii\db\QueryInterface (opens new window))$db
(yii\db\Connection (opens new window), null (opens new window))
# count()
View source (opens new window)
# getSlice()
Returns a slice of the items
View source (opens new window)
Arguments
$offset
(integer (opens new window))$limit
(integer (opens new window))
Returns
iterable