Batch
class Batch implements Arrayable, JsonSerializable
Methods
Create a new batch instance.
Prepare a chain that exists within the jobs being added.
Get the total number of jobs that have been processed by the batch thus far.
Get the percentage of jobs that have been processed (between 0-100).
Record that a job within the batch finished successfully, executing any callbacks if necessary.
Decrement the pending jobs for the batch.
Determine if the batch has finished executing.
Determine if the batch has "progress" callbacks.
Determine if the batch has "success" callbacks.
Determine if the batch allows jobs to fail without cancelling the batch.
Determine if the batch has job failures.
Record that a job within the batch failed to finish successfully, executing any callbacks if necessary.
Increment the failed jobs for the batch.
Determine if this is the first job processed in the batch.
Determine if the batch has "catch" callbacks.
Determine if the batch has "failure" callbacks.
Determine if the batch has "finally" callbacks.
Determine if the batch has been cancelled.
Determine if the batch has been cancelled.
Delete the batch from storage.
Invoke a batch callback handler.
Convert the batch to an array.
Get the JSON serializable representation of the object.
Dynamically access the batch's "options" via properties.
Details
at line 31
__construct(Factory $queue, BatchRepository $repository, string $id, string $name, int $totalJobs, int $pendingJobs, int $failedJobs, array $failedJobIds, array $options, CarbonImmutable $createdAt, CarbonImmutable|null $cancelledAt = null, CarbonImmutable|null $finishedAt = null)
Create a new batch instance.
at line 50
Batch|null
fresh()
Get a fresh instance of the batch represented by this ID.
at line 60
Batch|null
add(array|object $jobs)
Add additional jobs to the batch.
at line 135
protected Collection
prepareBatchedChain(array $chain)
Prepare a chain that exists within the jobs being added.
at line 147
int
processedJobs()
Get the total number of jobs that have been processed by the batch thus far.
at line 157
int
progress()
Get the percentage of jobs that have been processed (between 0-100).
at line 165
void
recordSuccessfulJob(string $jobId)
Record that a job within the batch finished successfully, executing any callbacks if necessary.
at line 215
UpdatedBatchJobCounts|null
decrementPendingJobs(string $jobId)
Decrement the pending jobs for the batch.
at line 223
protected void
invokeCallbacks(string $type, Throwable|null $e = null)
Invoke the callbacks of the given type.
at line 239
bool
finished()
Determine if the batch has finished executing.
at line 247
bool
hasProgressCallbacks()
Determine if the batch has "progress" callbacks.
at line 255
bool
hasThenCallbacks()
Determine if the batch has "success" callbacks.
at line 263
bool
allowsFailures()
Determine if the batch allows jobs to fail without cancelling the batch.
at line 271
bool
hasFailures()
Determine if the batch has job failures.
at line 279
void
recordFailedJob(string $jobId, Throwable|null $e)
Record that a job within the batch failed to finish successfully, executing any callbacks if necessary.
at line 325
UpdatedBatchJobCounts|null
incrementFailedJobs(string $jobId)
Increment the failed jobs for the batch.
at line 333
protected bool
isFirstJobProcessed(UpdatedBatchJobCounts $counts)
Determine if this is the first job processed in the batch.
at line 341
bool
hasCatchCallbacks()
Determine if the batch has "catch" callbacks.
at line 349
bool
hasFailureCallbacks()
Determine if the batch has "failure" callbacks.
at line 357
bool
hasFinallyCallbacks()
Determine if the batch has "finally" callbacks.
at line 365
void
cancel(Throwable|null $exception = null)
Cancel the batch.
at line 383
bool
canceled()
Determine if the batch has been cancelled.
at line 391
bool
cancelled()
Determine if the batch has been cancelled.
at line 399
void
delete()
Delete the batch from storage.
at line 407
protected void
invokeHandlerCallback(callable $handler, Batch $batch, Throwable|null $e = null)
Invoke a batch callback handler.
at line 425
array
toArray()
Convert the batch to an array.
at line 445
array
jsonSerialize()
Get the JSON serializable representation of the object.
at line 453
mixed
__get(string $key)
Dynamically access the batch's "options" via properties.