SetDecomposition
in package
Result of the recursive decomposition of a set into physical leaves ({@see \App\UI\Api\Eshop\Models\Services\SetCompositionService::decompose()}).
stockItemQuantities is what the Store needs (receipts, reservations, issues): the product of
count across all levels of the composition tree times the requested quantity, aggregated per
stock item (the same stock item in two branches of a set is summed).
unmappedVariantIds / unresolvedSetIds are a state, not an error: a variant without a stock
item, or a set that could not be decomposed (bundle without items, selling card without a variant,
nonexistent set, depth limit, deactivated component). The caller decides based on them (e.g. an
unavailable order item) and must not silently ignore them.
inactiveSetIds is a subset of unresolvedSetIds: components excluded because they are deleted
or deactivated. The front end does nothing extra with them (unresolved already means "on request");
the admin names the cause instead of a generic "not decomposable".
Table of Contents
Properties
- $inactiveSetIds : array<string|int, mixed>
- $stockItemQuantities : array<string|int, mixed>
- $unmappedVariantIds : array<string|int, mixed>
- $unresolvedSetIds : array<string|int, mixed>
- $variantQuantities : array<string|int, mixed>
Methods
- __construct() : mixed
- isFullyMapped() : bool
- Whether everything decomposed down to stock items (precondition for working with stock).
Properties
$inactiveSetIds read-only
public
array<string|int, mixed>
$inactiveSetIds
= []
$stockItemQuantities read-only
public
array<string|int, mixed>
$stockItemQuantities
$unmappedVariantIds read-only
public
array<string|int, mixed>
$unmappedVariantIds
$unresolvedSetIds read-only
public
array<string|int, mixed>
$unresolvedSetIds
$variantQuantities read-only
public
array<string|int, mixed>
$variantQuantities
Methods
__construct()
public
__construct(array<int, int> $stockItemQuantities, array<int, int> $variantQuantities, array<int, int> $unmappedVariantIds, array<int, int> $unresolvedSetIds[, array<int, int> $inactiveSetIds = [] ]) : mixed
Parameters
- $stockItemQuantities : array<int, int>
-
stockItemId => quantity
- $variantQuantities : array<int, int>
-
variantId => quantity (including variants without a stock item)
- $unmappedVariantIds : array<int, int>
-
variants without a stock item
- $unresolvedSetIds : array<int, int>
-
sets that could not be decomposed
- $inactiveSetIds : array<int, int> = []
-
of those, excluded because deleted or deactivated
isFullyMapped()
Whether everything decomposed down to stock items (precondition for working with stock).
public
isFullyMapped() : bool