Final Class Yiisoft\Db\Query\BatchQueryResult
| Inheritance | Yiisoft\Db\Query\BatchQueryResult |
|---|---|
| Implements | Yiisoft\Db\Query\BatchQueryResultInterface |
Represents the result of a batch query execution.
A batch query is a group of many SQL statements that are executed together as a single unit.
Public Methods
Method Details
| public mixed __construct ( Yiisoft\Db\Query\QueryInterface $query ) | ||
| $query | Yiisoft\Db\Query\QueryInterface | |
public function __construct(private readonly QueryInterface $query) {}
| public Yiisoft\Db\Query\BatchQueryResult batchSize ( integer $value ) | ||
| $value | integer | |
public function batchSize(int $value): static
{
$this->batchSize = $value;
return $this;
}
| public array current ( ) |
public function current(): array
{
if ($this->index === -1) {
$this->next();
}
return $this->batch;
}
| public Yiisoft\Db\Query\QueryInterface getQuery ( ) |
public function getQuery(): QueryInterface
{
return $this->query;
}
| public Yiisoft\Db\Query\BatchQueryResult indexBy ( Closure|string|null $indexBy ) | ||
| $indexBy | Closure|string|null | |
public function indexBy(Closure|string|null $indexBy): static
{
$this->indexBy = $indexBy;
return $this;
}
| public integer key ( ) |
public function key(): int
{
if ($this->index === -1) {
$this->next();
}
return $this->index;
}
| public void next ( ) |
public function next(): void
{
$this->batch = $this->fetchData();
++$this->index;
}
| public Yiisoft\Db\Query\BatchQueryResult resultCallback ( Closure|null $callback ) | ||
| $callback | Closure|null | |
public function resultCallback(?Closure $callback): static
{
$this->resultCallback = $callback;
return $this;
}
| public void rewind ( ) |
public function rewind(): void
{
if ($this->index === 0) {
return;
}
$this->dataReader = null;
$this->batch = $this->fetchData();
$this->index = 0;
}
Signup or Login in order to comment.