CoolCMS API

ReservationResult
in package

FinalYes

Outcome of {@see \App\UI\Api\Store\Models\Services\ReservationService::reserve()}. Value object (no DI — `*DTO*` folder mask).

status:

  • 'full' — every requested unit was reserved (also the idempotent re-reserve return);
  • 'partial' — some units reserved, some uncovered (only with allowPartial=true);
  • 'none' — nothing could be reserved (allowPartial=true, all uncovered);
  • 'error' — the operation did not run / was rolled back; see errorCode.

errorCode (only when status='error'): 'sourceLocked' | 'reservationExistsWithDifferentLines' | 'insufficientStock' (allowPartial=false shortfall, rolled back) | 'noLines'.

perLine maps stockItemId => the per-warehouse allocation that was made (waterfall order). notInStock maps stockItemId => the uncovered quantity (decimal string), present on 'partial', 'none' and the 'insufficientStock' error (so the caller can store it on the order line).

Tags
phpstan-type

Allocation array{warehouseId: int, quantity: string, deliveryDays: int|null}

Table of Contents

Properties

$errorCode  : string|null
$notInStock  : array<string|int, mixed>
$perLine  : array<string|int, mixed>
$status  : string

Methods

__construct()  : mixed
error()  : self

Properties

Methods

__construct()

public __construct(string $status[, array<int, array<int, array{warehouseId: int, quantity: string, deliveryDays: int|null}>> $perLine = [] ][, array<int, string> $notInStock = [] ][, string|null $errorCode = null ]) : mixed
Parameters
$status : string
$perLine : array<int, array<int, array{warehouseId: int, quantity: string, deliveryDays: int|null}>> = []
$notInStock : array<int, string> = []
$errorCode : string|null = null

error()

public static error(string $errorCode[, array<int, string> $notInStock = [] ]) : self
Parameters
$errorCode : string
$notInStock : array<int, string> = []
Return values
self
On this page

Search results