Tailor\Classes\ContentDecoder\Decoder
Overview
Decoder walks raw content data and applies it to a blueprint record, routing each attribute to scalar assignment, nested child creation, file attachment or relation association. Subclasses define the trust rules for their input source via the coerce hooks.
Public Methods
public decode()
public decode($model, $data, $sessionKey = null): void
decode applies each attribute in the data array to the model.
public decodeModelAttribute()
public decodeModelAttribute($model, $attr, $value, $sessionKey = null): void
decodeModelAttribute applies a single attribute value to the model.
Protected Methods
protected beforeDecodeAttribute()
protected beforeDecodeAttribute($model, $attr, &$value): bool
beforeDecodeAttribute can veto or transform an attribute before decoding.
protected coerceAssociationId()
protected coerceAssociationId($model, $attr, $value): void
coerceAssociationId gates the value before it is passed to a relation association.
protected coerceChildAttributes()
protected coerceChildAttributes($model, $attr, $value): void
coerceChildAttributes gates the attributes of a single child record before it is built.
protected coerceRelationValue()
protected coerceRelationValue($model, $attr, $value): void
coerceRelationValue gates the raw value before child records are built from it.
protected decodeFileRelation()
protected decodeFileRelation($model, $attr, $value, $sessionKey): void
decodeFileRelation creates file attachments from the source-specific value shape.
protected decodeRepeaterItem()
protected decodeRepeaterItem($model, $data, $sessionKey): void
decodeRepeaterItem applies nested data to a child record.
protected decodeRepeaterItems()
protected decodeRepeaterItems($model, $attr, $values, $sessionKey): void
decodeRepeaterItems builds child records from nested data.