PHP Trait Formo_ORM

ファイルを表示 Open project: bmidget/kohana-formo

Protected Properties

Property Type Description
$_foreign_keys mixed (default value: [])
$_formo_alias mixed Optional formo alias for form

Public Methods

Method Description
get_form ( array $fields, Formo $form = NULL ) : Formo Create a form from an ORM Model You can optionally pass a form to have fields added to
select_list ( mixed $result, mixed $key, mixed $value ) : array Utility method that just creates a array suitable for Formo opts from a result set

Protected Methods

Method Description
_field_exists ( $column )
_find_foreign_keys ( ) : void Fills $this->_foreign_keys in order to easier find foreign keys in all the process_type methods
_get_base_rules ( ) : array Apply rules based on mysql field definitions While you can skip these, it's a good idea to include them in your fields
_get_field_name ( ORM $model ) : string Convenience method for fetching the field name of a foreign model Formo allows
_process_belongs_to ( mixed $field_name, array &$options ) : void Add options to belongs_to fields
_process_enum ( mixed $field_name, array &$options ) : void Set up options for enum fields
_process_has_one ( mixed $field_name, array &$options ) : void Set up options for has_one relationships
_process_set ( mixed $field_name, array &$options ) : void Set up options for set fields
formo ( mixed $form ) : void Post-production after get_form

Method Details

_field_exists() protected method

protected _field_exists ( $column )

_find_foreign_keys() protected method

Fills $this->_foreign_keys in order to easier find foreign keys in all the process_type methods
protected _find_foreign_keys ( ) : void
return void

_get_base_rules() protected method

Apply rules based on mysql field definitions While you can skip these, it's a good idea to include them in your fields
protected _get_base_rules ( ) : array
return array

_get_field_name() protected static method

Convenience method for fetching the field name of a foreign model Formo allows
protected static _get_field_name ( ORM $model ) : string
$model ORM
return string

_process_belongs_to() protected method

Add options to belongs_to fields
protected _process_belongs_to ( mixed $field_name, array &$options ) : void
$field_name mixed
$options array
return void

_process_enum() protected method

Set up options for enum fields
protected _process_enum ( mixed $field_name, array &$options ) : void
$field_name mixed
$options array
return void

_process_has_one() protected method

Set up options for has_one relationships
protected _process_has_one ( mixed $field_name, array &$options ) : void
$field_name mixed
$options array
return void

_process_set() protected method

Set up options for set fields
protected _process_set ( mixed $field_name, array &$options ) : void
$field_name mixed
$options array
return void

formo() protected method

Post-production after get_form
protected formo ( mixed $form ) : void
$form mixed
return void

get_form() public method

Create a form from an ORM Model You can optionally pass a form to have fields added to
public get_form ( array $fields, Formo $form = NULL ) : Formo
$fields array (default: NULL)
$form Formo (default: NULL)
return Formo

select_list() public static method

Utility method that just creates a array suitable for Formo opts from a result set
public static select_list ( mixed $result, mixed $key, mixed $value ) : array
$result mixed
$key mixed
$value mixed
return array

Property Details

$_foreign_keys protected_oe property

(default value: [])
protected mixed $_foreign_keys
return mixed

$_formo_alias protected_oe property

Optional formo alias for form
protected mixed $_formo_alias
return mixed