\Hazaar\Model
Email
Email Address Strict Model

This is a simple model that enforces the format of an email address.

It currently has a single field called ‘address’ that is used to validate the email address format.

Tags

Author

Jamie Carl

Since

2.2

Summary
Methods Properties Constants
ake
get
has
key
set
No constants
Properties
Inherited
$allow_undefined
$allow_undefined
Undefined values will be automatically added and their type will be detected.
Inherited
$convert_nulls
$convert_nulls
Automatically convert null values to empty strings if the field is of type string.
Inherited
$current
$current
The current value for array access returned by each().
Inherited
$disable_callbacks
$disable_callbacks
Disable all callbacks while this is true.
Inherited
$fields
$fields
The field definition.
Inherited
$ignore_undefined
$ignore_undefined
Undefined values will be ignored. This is checked first.
Inherited
$values
$values
The current values of all defined fields.
Methods
__construct()
__construct($data)

Parameters

$data

No description

__toString()
__toString()
init()
init() : array[]
Initialise the model.

Returns

array[]
Inherited
__get()
__get($key)

Parameters

$key

No description

Inherited
__set()
__set($key, $value)

Parameters

$key

No description

$value

No description

Inherited
ake()
ake($key, $default = null, $non_empty = false)

Parameters

$key

No description

$default

No description

$non_empty

No description

Inherited
append()
append($key, $item) : mixed
Append an element to an array item

Parameters

$keymixed

The name of the array field to append to.

$itemmixed

The item to append on to the end of the array.

Returns

mixed

The item that was just appended.

Inherited
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.

Parameters

$callbackmixed

Typically, callback takes on two parameters. The array parameter’s value being the first, and the key/index second.

$userdatamixed

If the optional userdata parameter is supplied, it will be passed as the third parameter to the callback.

Inherited
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.

Parameters

$callbackmixed

Typically, callback takes on two parameters. The array parameter’s value being the first, and the key/index second.

$userdatamixed

If the optional userdata parameter is supplied, it will be passed as the third parameter to the callback.

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

Tags

Since

1.3.0

Returns

int
Inherited
current()
current()

Return the current element in the model

Tags

Since

1.0.0

Inherited
exportHMV()
exportHMV($ignore_empty = false, $export_all = false, $obj = null) : array
Export the mdel in HazaarModelView format for easy display in views.

Tags

Since

2.0.0

Parameters

$ignore_empty

No description

$export_all

No description

$obj

No description

Returns

array

The array of values stored in the model in key => (label, value) tuples. Returns null if model is empty.

Inherited
extend()
extend($values, $exec_filters = true, $ignore_keys = null)

Parameters

$values

No description

$exec_filters

No description

$ignore_keys

No description

Inherited
find()
find($field, $criteria = Array ( ) , $multiple = false)

Parameters

$field

No description

$criteria

No description

$multiple

No description

Inherited
get()
get($key, $exec_filters = true)

Parameters

$key

No description

$exec_filters

No description

Inherited
getDefinition()
getDefinition($key) : array
Return the field definition for the requested field.

Parameters

$keymixed

The key of the field to return the definition for.

Returns

array
Inherited
getType()
getType($key)

Parameters

$key

No description

Inherited
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.

Parameters

$keymixed

The field name to check.

Returns

boolean
Inherited
hasValues()
hasValues() : boolean
Test if any fields have non-null values

Returns

boolean
Inherited
isObject()
isObject($key)

Parameters

$key

No description

Inherited
jsonSerialize()
jsonSerialize()
Inherited
key()
key()

Return the current key from the model

Tags

Since

1.0.0

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

Parameters

$field_definitionarray

No description

Inherited
next()
next()

Move to the next element in the model

Tags

Since

1.0.0

Inherited
offsetExists()
offsetExists($offset)
Array Access Methods

Parameters

$offset

No description

Inherited
offsetGet()
offsetGet($offset)

Parameters

$offset

No description

Inherited
offsetSet()
offsetSet($offset, $value)

Parameters

$offset

No description

$value

No description

Inherited
offsetUnset()
offsetUnset($offset)

Parameters

$offset

No description

Inherited
populate()
populate($data, $exec_filters = false) : boolean
Populate the model with data contained in the supplied array.

Parameters

$datamixed

The array of data.

$exec_filtersmixed

Execute any callback filters. For populate this is disabled by default.

Returns

boolean
Inherited
prepare()
prepare($data)

Parameters

$data

No description

Inherited
push()
push($key, $item) : mixed
Alias for Hazaar\Model\Strict::append()

Added to help remove some confusion as to appends purpose.

Parameters

$keystring

The name of the array field to push to.

$itemmixed

The item to push on to the end of the array.

Returns

mixed

The item that was just pushed.

Inherited
rewind()
rewind()

Set the internal pointer the first element

Tags

Since

1.0.0

Inherited
set()
set($key, $value, $exec_filters = true)

Parameters

$key

No description

$value

No description

$exec_filters

No description

Inherited
toArray()
toArray($disable_callbacks = false, $depth = null, $show_hidden = true)
Convert data into an array

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

Tags

Since

1.0.0

Parameters

$disable_callbacks

No description

$depth

No description

$show_hidden

No description

Inherited
valid()
valid()

Test that an element exists at the current internal pointer position

Tags

Since

1.0.0