class Illuminate / Bus / Batch
You are viewing an older version of the documentation. For the latest, please visit master documentation.

Batch

Implements

Properties

protected

$queue Factory

The queue factory implementation.

Default: null
protected

$repository BatchRepository

The repository implementation.

Default: null
public

$id string

The batch ID.

Default: null
public

$name string

The batch name.

Default: null
public

$totalJobs int

The total number of jobs that belong to the batch.

Default: null
public

$pendingJobs int

The total number of jobs that are still pending.

Default: null
public

$failedJobs int

The total number of jobs that have failed.

Default: null
public

$failedJobIds array

The IDs of the jobs that have failed.

Default: null
public

$options array

The batch options.

Default: null
public

$createdAt Carbon\CarbonImmutable

The date indicating when the batch was created.

Default: null
public

$cancelledAt Carbon\CarbonImmutable|null

The date indicating when the batch was cancelled.

Default: null
public

$finishedAt Carbon\CarbonImmutable|null

The date indicating when the batch was finished.

Default: null

Methods

public

__construct ( Factory $queue , BatchRepository $repository , string $id , string $name , int $totalJobs , int $pendingJobs , int $failedJobs , array $failedJobIds , array $options , Carbon\CarbonImmutable $createdAt , Carbon\CarbonImmutable $cancelledAt , Carbon\CarbonImmutable $finishedAt ) : void

Create a new batch instance.

Parameters

  • $queue Factory
  • $repository BatchRepository
  • $id string
  • $name string
  • $totalJobs int
  • $pendingJobs int
  • $failedJobs int
  • $failedJobIds array
  • $options array
  • $createdAt Carbon\CarbonImmutable
  • $cancelledAt Carbon\CarbonImmutable|null
  • $finishedAt Carbon\CarbonImmutable|null
public

fresh ( ) : self

Get a fresh instance of the batch represented by this ID.

public

add ( $jobs ) : self

Add additional jobs to the batch.

Parameters

protected

prepareBatchedChain ( array $chain ) : Collection

Prepare a chain that exists within the jobs being added.

Parameters

  • $chain array
public

processedJobs ( ) : int

Get the total number of jobs that have been processed by the batch thus far.

public

progress ( ) : int

Get the percentage of jobs that have been processed (between 0-100).

public

recordSuccessfulJob ( string $jobId ) : void

Record that a job within the batch finished successfully, executing any callbacks if necessary.

Parameters

  • $jobId string
public

decrementPendingJobs ( string $jobId ) : UpdatedBatchJobCounts

Decrement the pending jobs for the batch.

Parameters

  • $jobId string
public

finished ( ) : bool

Determine if the batch has finished executing.

public

hasThenCallbacks ( ) : bool

Determine if the batch has "success" callbacks.

public

allowsFailures ( ) : bool

Determine if the batch allows jobs to fail without cancelling the batch.

public

hasFailures ( ) : bool

Determine if the batch has job failures.

public

recordFailedJob ( string $jobId , $e ) : void

Record that a job within the batch failed to finish successfully, executing any callbacks if necessary.

Parameters

public

incrementFailedJobs ( string $jobId ) : UpdatedBatchJobCounts

Increment the failed jobs for the batch.

Parameters

  • $jobId string
public

hasCatchCallbacks ( ) : bool

Determine if the batch has "catch" callbacks.

public

hasFinallyCallbacks ( ) : bool

Determine if the batch has "finally" callbacks.

public

cancel ( ) : void

Cancel the batch.

public

canceled ( ) : bool

Determine if the batch has been cancelled.

public

cancelled ( ) : bool

Determine if the batch has been cancelled.

public

delete ( ) : void

Delete the batch from storage.

protected

invokeHandlerCallback ( $handler , Batch $batch , Throwable $e ) : void

Invoke a batch callback handler.

Parameters

public

toArray ( ) : array

Convert the batch to an array.

public

jsonSerialize ( ) : array

Get the JSON serializable representation of the object.

public

__get ( $key ) : mixed

Dynamically access the batch's "options" via properties.

Parameters

  • $key string