Documentation

Batch
in package
implements BatchInterface

Default batch implementation used to convert queued items into smaller chunks of batches using a {@see BatchDivisorIterface} and transfers each batch using a {@see BatchTransferInterface}.

Any exception encountered during a flush operation will throw a BatchTransferException object containing the batch that failed. After an exception is encountered, you can flush the batch again to attempt to finish transferring any previously created batches or queued items.

Table of Contents

Interfaces

BatchInterface
Interface for efficiently transferring items in a queue using batches

Properties

$dividedBatches  : array<string|int, mixed>
$divisionStrategy  : BatchDivisorInterface
$queue  : SplQueue
$transferStrategy  : BatchTransferInterface

Methods

__construct()  : mixed
add()  : self
Add an item to the queue
flush()  : array<string|int, mixed>
Flush the batch and transfer the items
isEmpty()  : bool
Check if the batch is empty and has further items to transfer
createBatches()  : mixed
Create batches for any queued items

Properties

$dividedBatches

protected array<string|int, mixed> $dividedBatches

Divided batches to be transferred

$queue

protected SplQueue $queue

Queue of items in the queue

Methods

add()

Add an item to the queue

public add(mixed $item) : self
Parameters
$item : mixed

Item to add

Return values
self

flush()

Flush the batch and transfer the items

public flush() : array<string|int, mixed>
Return values
array<string|int, mixed>

Returns an array flushed items

isEmpty()

Check if the batch is empty and has further items to transfer

public isEmpty() : bool
Return values
bool

createBatches()

Create batches for any queued items

protected createBatches() : mixed

        
On this page

Search results