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#
| Constant | Value | Description |
|---|---|---|
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#
| Property | Type | Description |
|---|---|---|
$backoff | list<int> | |
$disk readonly | ?string | |
$invoice readonly | string | |
$options | RenderOptions|string | JSON of RenderOptions::toArray(); a RenderOptions object in jobs queued by Quittio 0.1.0. |
$path readonly | ?string | |
$tries | int |
Methods#
| Method | Description |
|---|---|
->__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,
)| Parameter | Type | Description |
|---|---|---|
$invoice | string | |
$options | RenderOptions|string | |
$disk | ?string = null | |
$path | ?string = null |
data()#
public function data(?SnapshotUpcasterChain $upcasters = null): InvoiceDataThe 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.
| Parameter | Type | Description |
|---|---|---|
$upcasters | ?SnapshotUpcasterChain = null |
- Returns
InvoiceData
failed()#
public function failed(Throwable $exception): voidCalled by the queue worker when the job failed for good.
| Parameter | Type | Description |
|---|---|---|
$exception | Throwable |
handle()#
public function handle(
QuittioManager $quittio,
?SnapshotUpcasterChain $upcasters = null,
): voidRenders 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.
| Parameter | Type | Description |
|---|---|---|
$quittio | QuittioManager | |
$upcasters | ?SnapshotUpcasterChain = null |
middleware()#
public function middleware(): list<object>- Returns
list<object>
renderOptions()#
public function renderOptions(): RenderOptionsThe 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