PropertyMapper

Class

Manage forward and backward property mappings to streamline conversion between the Hub entities, and the backing IModel

Constructors

Constructor Parameters

Parameter Type Default Notes
mappings Required IPropertyMap[]

Properties

Property Type Notes
mappings IPropertyMap[]

Methods

Method Returns Notes

Map properties from a model on to the entity object.

Used when constructing an entity can from a fetched model, in which case the entity should be an empty object ({}).

Can also be used to apply changes to an entity from a model, in which case an existing entity can be passed in.

IModel

Map properties from an entity object onto a model.

Typically the model will already exist, and this method is used to transfer changes to the model prior to storage.

modelToObject

Class Method

Map properties from a model on to the entity object.

  • modelToObject(model: IModel, object: ) :

Parameters

Parameter Type Default Notes
model Required IModel
object Required

Returns


Used when constructing an entity can from a fetched model, in which case the entity should be an empty object ({}).

Can also be used to apply changes to an entity from a model, in which case an existing entity can be passed in.

objectToModel

Class Method

Map properties from an entity object onto a model.

Parameters

Parameter Type Default Notes
object Required
model Required IModel

Returns


Typically the model will already exist, and this method is used to transfer changes to the model prior to storage.


Class defined in common/src/core/_internal/PropertyMapper.ts:8