hydrateDeliveryRouteAssignment.php
Table of Contents
Functions
- hydrateDeliveryRouteAssignment() : mixed
- Hydrate an array definition with the DeliveryRouteAssignment class.
Functions
hydrateDeliveryRouteAssignment()
Hydrate an array definition with the DeliveryRouteAssignment class.
hydrateDeliveryRouteAssignment([mixed $init = null ]) : mixed
Handles both a single assignment array and a list of them — the list being the usual shape, since a same address is commonly served by more than one route.
The nested route is resolved into a DeliveryRouteTerm when it holds
the joined reference row. A bare code is left untouched : nothing has been
joined yet, and inventing a term out of a string would claim a label nobody
read.
route is hydrated only when the raw value is an array — when there is something
to hydrate. The helper's answer is then written as is, null included : an array
that resolves to nothing becomes null, never a leftover raw array.
🔑 A bare reference survives inside a list, exactly as it does on its own : a list of unresolved handles comes back as it stands, and only an entry that was an array and resolved to nothing is dropped. The keys stay gap-free — a filtered list left with holes serializes as a JSON object, and a consumer walking the value gets something it cannot walk.
Parameters
- $init : mixed = null
-
Single DeliveryRouteAssignment data or array of DeliveryRouteAssignment data.