hydrateDocumentLine.php
Table of Contents
Functions
- hydrateDocumentLine() : mixed
- Hydrate an array definition with the BusinessDocumentLine class.
Functions
hydrateDocumentLine()
Hydrate an array definition with the BusinessDocumentLine class.
hydrateDocumentLine([mixed $init = null ]) : mixed
Handles both a single line array and an array of lines — the two shapes a
BusinessDocument documentLines
payload can take.
The line is built through Reflection::hydrate() rather than the
BusinessDocumentLine constructor : only that path honors the
#[HydrateAs] / #[HydrateWith] attributes declared on the class, so
adjustments, price (and its priceComponent breakdown), quantity,
subtotal, taxes and total come out typed instead of staying raw arrays.
The item property is the exception : its Product|Service union cannot be
resolved from the property type alone, so it is delegated to
hydrateDocumentLineItem() which reads the payload's @type.
Parameters
- $init : mixed = null
-
Single line data or array of line data.