Hazaar\Model
Strict
Abstract
Summary
MethodsPropertiesConstants
No constants
Properties
$allow_undefined
$allow_undefined
Undefined values will be automatically added and their type will be detected.
$args
$args
Stored arguments provided to the constructor
$convert_nulls
$convert_nulls
Automatically convert null values to empty strings if the field is of type string.
$current
$current
The current value for array access returned by Strict::each().
$disable_callbacks
$disable_callbacks
Disable all callbacks while this is true.
$fields
$fields
The field definition.
$ignore_undefined
$ignore_undefined
Undefined values will be ignored. This is checked first.
$loaded
$loaded
Internal loaded flag. This allows read only fields to be set during startup.
$values
$values
The current values of all defined fields.
Methods
__call()
__call($func, $argv) : mixed
Magic method for calling array_* functions on the \Hazaar\Model\Strict class.
__construct()
__construct(array)
Strict model constructor

The constructor has optional parameters that can vary depending on the implementation. The first parameter is an array containing the initial data to be loaded into the model. Any subsequent arguments are passed directly and "as is" to the Hazaar\Model\Strict::construct() method implemented by the extending class.

__destruct()
__destruct()
__get()
__get($key)
__init()
__init()
__set()
__set($key, $value)
ake()
ake($key, $default = null, $non_empty = false)
allowUndefined()
allowUndefined($toggle = true)
append()
append($key, $item) : mixed
Append an element to an array item
array_walk()
array_walk($callback, $userdata = null)
Apply a user supplied function to every member of an array

Applies the user-defined callback function to each element of the array array.

ChildArray::walk() is not affected by the internal array pointer of array. ChildArray::walk() will walk through the entire array regardless of pointer position.

For more information on this method see PHP's array_walk() function.

array_walk_recursive()
array_walk_recursive($callback, $userdata = null)
Apply a user supplied function to every member of an array

Applies the user-defined callback function to each element of the array array.

ChildArray::walk() is not affected by the internal array pointer of array. ChildArray::walk() will walk through the entire array regardless of pointer position.

For more information on this method see PHP's array_walk() function.

count()
count() : int
Returns the number of fields stored in the model.
current()
current()

Return the current element in the model

each()
each()
execCallback()
execCallback($cb_def, $value, $key) : mixed

Execute the a callback function on a key/value pair.

exportHMV()
exportHMV($ignore_empty = false, $export_all = false, $obj = null) : array
Export the mdel in HazaarModelView format for easy display in views.
exportHMVArray()
exportHMVArray($array, $def, $hide_empty = false, $export_all = false, $object = null) : array
Exports and array in HazaarModelView format using the supplied definition
extend()
extend($values, $exec_filters = true, $ignore_keys = null)
find()
find($field, $criteria = Array ( ) , $multiple = false)
get()
get($key, $exec_filters = true)
getDefinition()
getDefinition($key) : array
Return the field definition for the requested field.
getType()
getType($key)
has()
has($key) : boolean
Return true/false indicating if a field has been defined.

If the field is not "defined" but instead $allow_undefined has been enabled and the field was added, this will also return true.

hasValues()
hasValues() : boolean
Test if any fields have non-null values
isObject()
isObject($key)
jsonSerialize()
jsonSerialize()
key()
key()

Return the current key from the model

loadDefinition()
loadDefinition($field_definition)
Loads the provided field definition into the model.
next()
next()

Move to the next element in the model

offsetExists()
offsetExists($offset)
Array Access Methods
offsetGet()
offsetGet($offset)
offsetSet()
offsetSet($offset, $value)
offsetUnset()
offsetUnset($offset)
populate()
populate($data, $exec_filters = true) : boolean
Populate the model with data contained in the supplied array.
prepare()
prepare($data)
push()
push($key, $item) : mixed
Alias for Hazaar\Model\Strict::append()

Added to help remove some confusion as to appends purpose.

remove()
remove($key)
resolveArray()
resolveArray($array, $disable_callbacks = false, $depth = null, $show_hidden = false, $export_data_binder = true)
rewind()
rewind()

Set the internal pointer the first element

set()
set($key, $value, $exec_filters = true)
toArray()
toArray($disable_callbacks = false, $depth = null, $show_hidden = true, $export_data_binder = false)
Convert data into an array

If field values are Strict models, then convert them to arrays as well.

valid()
valid()

Test that an element exists at the current internal pointer position