class DatabaseBatchRepository implements PrunableBatchRepository

Methods

__construct(BatchFactory $factory, ConnectionResolverInterface $resolver, string $table, string|null $connection = null)

Create a new batch repository instance.

array
get(int $limit = 50, mixed $before = null)

Retrieve a list of batches.

Batch|null
find(int|string $batchId)

Retrieve information about an existing batch.

store(PendingBatch $batch)

Store a new pending batch.

void
incrementTotalJobs(int|string $batchId, int $amount)

Increment the total number of jobs within the batch.

decrementPendingJobs(int|string $batchId, string $jobId)

Decrement the total number of pending jobs for the batch.

incrementFailedJobs(int|string $batchId, string $jobId)

Increment the total number of failed jobs for the batch.

array|null
updateAtomicValues(int|string $batchId, Closure $callback)

Update an atomic value within the batch.

void
markAsFinished(int|string $batchId)

Mark the batch that has the given ID as finished.

void
cancel(int|string $batchId)

Cancel the batch that has the given ID.

void
delete(int|string $batchId)

Delete the batch that has the given ID.

int
prune(DateTimeInterface $before)

Prune all of the entries older than the given date.

int
pruneUnfinished(DateTimeInterface $before)

Prune all of the unfinished entries older than the given date.

int
pruneCancelled(DateTimeInterface $before)

Prune all of the cancelled entries older than the given date.

mixed
transaction(Closure $callback)

Execute the given Closure within a storage specific transaction.

void
rollBack()

Rollback the last database transaction for the connection.

string
serialize(mixed $value)

Serialize the given value.

mixed
unserialize(string $serialized)

Unserialize the given value.

toBatch(object $batch)

Convert the given raw batch to a Batch object.

getConnection()

Get the underlying database connection.

Details

at line 23
__construct(BatchFactory $factory, ConnectionResolverInterface $resolver, string $table, string|null $connection = null)

Create a new batch repository instance.

Parameters

BatchFactory $factory
ConnectionResolverInterface $resolver
string $table
string|null $connection

at line 36
array get(int $limit = 50, mixed $before = null)

Retrieve a list of batches.

Parameters

int $limit
mixed $before

Return Value

array

at line 52
Batch|null find(int|string $batchId)

Retrieve information about an existing batch.

Parameters

int|string $batchId

Return Value

Batch|null

at line 65
Batch store(PendingBatch $batch)

Store a new pending batch.

Parameters

PendingBatch $batch

Return Value

Batch

at line 94
void incrementTotalJobs(int|string $batchId, int $amount)

Increment the total number of jobs within the batch.

Parameters

int|string $batchId
int $amount

Return Value

void

at line 106
UpdatedBatchJobCounts|null decrementPendingJobs(int|string $batchId, string $jobId)

Decrement the total number of pending jobs for the batch.

Parameters

int|string $batchId
string $jobId

Return Value

UpdatedBatchJobCounts|null

at line 125
UpdatedBatchJobCounts|null incrementFailedJobs(int|string $batchId, string $jobId)

Increment the total number of failed jobs for the batch.

Parameters

int|string $batchId
string $jobId

Return Value

UpdatedBatchJobCounts|null

at line 144
protected array|null updateAtomicValues(int|string $batchId, Closure $callback)

Update an atomic value within the batch.

Parameters

int|string $batchId
Closure $callback

Return Value

array|null

at line 160
void markAsFinished(int|string $batchId)

Mark the batch that has the given ID as finished.

Parameters

int|string $batchId

Return Value

void

at line 170
void cancel(int|string $batchId)

Cancel the batch that has the given ID.

Parameters

int|string $batchId

Return Value

void

at line 181
void delete(int|string $batchId)

Delete the batch that has the given ID.

Parameters

int|string $batchId

Return Value

void

at line 189
int prune(DateTimeInterface $before)

Prune all of the entries older than the given date.

Parameters

DateTimeInterface $before

Return Value

int

at line 209
int pruneUnfinished(DateTimeInterface $before)

Prune all of the unfinished entries older than the given date.

Parameters

DateTimeInterface $before

Return Value

int

at line 229
int pruneCancelled(DateTimeInterface $before)

Prune all of the cancelled entries older than the given date.

Parameters

DateTimeInterface $before

Return Value

int

at line 254
mixed transaction(Closure $callback)

Execute the given Closure within a storage specific transaction.

Parameters

Closure $callback

Return Value

mixed

at line 262
void rollBack()

Rollback the last database transaction for the connection.

Return Value

void

at line 270
protected string serialize(mixed $value)

Serialize the given value.

Parameters

mixed $value

Return Value

string

at line 282
protected mixed unserialize(string $serialized)

Unserialize the given value.

Parameters

string $serialized

Return Value

mixed

at line 300
protected Batch toBatch(object $batch)

Convert the given raw batch to a Batch object.

Parameters

object $batch

Return Value

Batch

at line 320
ConnectionInterface getConnection()

Get the underlying database connection.

Return Value

ConnectionInterface