Zum Inhalt springen

API reference / Quittio \ Laravel \ Jobs

RenderInvoice

final class in quittio/laravel · implements Illuminate\Contracts\Queue\ShouldQueue · uses Illuminate\Queue\InteractsWithQueue, Illuminate\Bus\Queueable

Quittio\Laravel\Jobs\RenderInvoice · Source

Renders an invoice in the queue and stores the main output on a disk.

The invoice travels as JSON snapshot with its version, so jobs queued before an update of the data model are brought up to date by the configured upcasters; the render options travel as versioned JSON as well (RenderOptions::toArray()). Errors that another attempt cannot fix (validation, invalid data, configuration) fail the job at once; others, e.g. a disk that is not reachable, are retried.

Constants#

ConstantValueDescription
PERMANENT_ERRORS[\Quittio\Core\Validation\ValidationException::class, \Quittio\Core\Exceptions\InvalidInvoiceData::class, \Quittio\Core\Calculation\CalculationException::class, …Exceptions that fail the job without a further attempt.

Properties#

PropertyTypeDescription
$backofflist<int>
$disk readonly?string
$invoice readonlystring
$optionsRenderOptions|stringJSON of RenderOptions::toArray(); a RenderOptions object in jobs queued by Quittio 0.1.0.
$path readonly?string
$triesint

Methods#

MethodDescription
->__construct()
->data()The invoice of the job: a versioned snapshot brought up to date by $upcasters (default: the shared chain), or a plain InvoiceData::toJson() payload. Throws a JsonException for invalid JSON.
->failed()Called by the queue worker when the job failed for good.
->handle()Renders the invoice with the queued options, stores the main output on the disk and path of the job and dispatches QueuedInvoiceStored. The container passes the configured upcaster chain for older snapshots.
->middleware()
->renderOptions()The render options of the job, decoded from their JSON; a RenderOptions object of a job queued by Quittio 0.1.0 is returned as is.

__construct()#

public function __construct(
    string $invoice,
    RenderOptions|string $options,
    ?string $disk = null,
    ?string $path = null,
)
ParameterTypeDescription
$invoicestring
$optionsRenderOptions|string
$disk?string = null
$path?string = null

data()#

public function data(?SnapshotUpcasterChain $upcasters = null): InvoiceData

The invoice of the job: a versioned snapshot brought up to date by $upcasters (default: the shared chain), or a plain InvoiceData::toJson() payload. Throws a JsonException for invalid JSON.

ParameterTypeDescription
$upcasters?SnapshotUpcasterChain = null
Returns
InvoiceData

failed()#

public function failed(Throwable $exception): void

Called by the queue worker when the job failed for good.

ParameterTypeDescription
$exceptionThrowable

handle()#

public function handle(
    QuittioManager $quittio,
    ?SnapshotUpcasterChain $upcasters = null,
): void

Renders the invoice with the queued options, stores the main output on the disk and path of the job and dispatches QueuedInvoiceStored. The container passes the configured upcaster chain for older snapshots.

ParameterTypeDescription
$quittioQuittioManager
$upcasters?SnapshotUpcasterChain = null

middleware()#

public function middleware(): list<object>
Returns
list<object>

renderOptions()#

public function renderOptions(): RenderOptions

The render options of the job, decoded from their JSON; a RenderOptions object of a job queued by Quittio 0.1.0 is returned as is.

Returns
RenderOptions

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.