\Nano4\ControllersModelConf

A trait that adds model configuration to your controllers.

Summary

Methods
Properties
Constants
get_models_of_type()
get_models_with_type()
No public properties found
No constants found
__construct_modelconf_controller()
populate_model_opts()
get_model_opts()
get_db_model_opts()
$model_opts
N/A
No private methods found
No private properties found
N/A

Properties

$model_opts

$model_opts : 

Type

Methods

get_models_of_type()

get_models_of_type(  $type) 

Return a list of models with a specific ".type" definition, along with the flat model options.

[ 'modelname' => $model_opts, // more here ]

Parameters

$type

get_models_with_type()

get_models_with_type(  $type,   $opts = array()) 

Return a list of models that are decended from a type, no matter how deep in the group hierarchy they are. Also returns the expanded model options (as returned by get_model_opts() with @types enabled.)

[ 'modelname' => $extended_model_opts, // more here ]

Parameters

$type
$opts

__construct_modelconf_controller()

__construct_modelconf_controller(  $opts = array()) 

Parameters

$opts

populate_model_opts()

populate_model_opts(  $model,   $opts) 

Parameters

$model
$opts

get_model_opts()

get_model_opts(  $model, Array  $opts = array(), Array  $behavior = array()) 

Get model options from our $this->model_opts definitions.

Parameters

$model
Array $opts

Current/overridden options.

Array $behavior

See below

If the $behavior['defaults'] is True, and we cannot find a set of options for the specified model, then we will look for a set of options called '.default' and use that instead.

A special option called '.type' allows for nesting option defintions. If set in any level, an option group with the name of the '.type' will be looked up, and any options in its definition will be added (if they don't already exist.) Groups may have their own '.type' option, allowing for multiple levels of nesting.

If $behavior['types'] is True, we build a list of all nested groups.

The '.type' rule MUST NOT start with a dot. The group definition MUST start with a dot. The dot will be assumed on all groups.

So if a '.type' option is set to 'common', then a group called '.common' will be inherited from.

get_db_model_opts()

get_db_model_opts(  $model,   $opts) 

Parameters

$model
$opts