Object.zSetFields
zSetFields($fieldMap) -> self
Description
Set public fields on an object, from a given Map.
This is a convenient method for converting a database row (Map) to an object.
Note: New fields can only be created in the new constructor method.
class MyClass {
fields {
id: 0
color: ''
}
}
$fields = {
id: 123
color: 'green'
}
$object = MyClass($fields)
$object.zGetFields()
//= { id: 123, color: 'green' }