IModelMapper
Defines an object that maps raw results from some data source to an IModel instance
Table of Contents
createAndMap() | Maps a map of raw data (attribute => value) to an IModel instance. | IModel |
---|---|---|
map() | Map some data to properties in some model. | void |
getClass() | Retrieve the class or interface name this mapper works with. | string |
test() | Test that the supplied model implements the interface or class name returned by getClass(). | void |
Methods
createAndMap()
Maps a map of raw data (attribute => value) to an IModel instance.
public
createAndMap(
$data :
array
[, $propertySet :
IPropertySet|null
= null ]
)
: IModel
Parameters
- $data : array
data to map
Optionally accepts an IPropertySet instance. Supplied if passed to the IModelMapper constructor. f( ?IPropertySet $propertySet ) : IModel
- $propertySet : IPropertySet|null = null
An optional property set. If this is passed, then the supplied IPropertySet is passed to the $createModel Closure as the first argument.
Tags
Return values
IModel —model instance
map()
Map some data to properties in some model.
public
map(
$model :
IModel
, $data :
array
)
: void
Invalid properties are silently ignored.
Parameters
- $model : IModel
Model to push data into
- $data : array
data to push
getClass()
Retrieve the class or interface name this mapper works with.
public
getClass(
)
: string
Return values
string —name
test()
Test that the supplied model implements the interface or class name returned by getClass().
public
test(
...$models :
IModel
)
: void
Parameters
- $models : IModel
One or more models to test