class FormModel extends BaseDatabaseModel

Prototype form model.

Methods

static  array
addIncludePath( mixed $path = '', string $prefix = '')

Add a directory where \JModelLegacy should search for models. You may either pass a string or an array of directories.

static  void
addTablePath( mixed $path)

Adds to the stack of model table paths in LIFO order.

static  JModelLegacy|boolean
getInstance( string $type, string $prefix = '', array $config = array())

Returns a Model object, always creating it

__construct( array $config = array())

Constructor.

getDbo()

Method to get the database driver object

string
getName()

Method to get the model name

mixed
getState( string $property = null, mixed $default = null)

Method to get model state variables

JTable
getTable( string $name = '', string $prefix = 'Table', array $options = array())

Method to get a table object, load it if necessary.

boolean
loadHistory( integer $version_id, JTable $table)

Method to load a row for editing from the version history table.

void
setDbo( JDatabaseDriver $db)

Method to set the database driver object

mixed
setState( string $property, mixed $value = null)

Method to set model state variables

boolean
checkin( integer $pk = null)

Method to checkin a row.

boolean
checkout( integer $pk = null)

Method to check-out a row for editing.

JForm|boolean
getForm( array $data = array(), boolean $loadData = true)

Abstract method for getting the form from the model.

array|boolean
validate( JForm $form, array $data, string $group = null)

Method to validate the form data.

Details

static array addIncludePath( mixed $path = '', string $prefix = '')

Add a directory where \JModelLegacy should search for models. You may either pass a string or an array of directories.

Parameters

mixed $path A path or array[sting] of paths to search.
string $prefix A prefix for models.

Return Value

array An array with directory elements. If prefix is equal to '', all directories are returned.

static void addTablePath( mixed $path)

Adds to the stack of model table paths in LIFO order.

Parameters

mixed $path The directory as a string or directories as an array to add.

Return Value

void

static JModelLegacy|boolean getInstance( string $type, string $prefix = '', array $config = array())

Returns a Model object, always creating it

Parameters

string $type The model type to instantiate
string $prefix Prefix for the model class name. Optional.
array $config Configuration array for model. Optional.

Return Value

JModelLegacy|boolean A \JModelLegacy instance or false on failure

__construct( array $config = array())

Constructor.

Parameters

array $config An array of configuration options (name, state, dbo, tablepath, ignorerequest).

See also

\JModelLegacy

JDatabaseDriver getDbo()

Method to get the database driver object

Return Value

JDatabaseDriver

string getName()

Method to get the model name

The model name. By default parsed using the classname or it can be set by passing a $config['name'] in the class constructor

Return Value

string The name of the model

Exceptions

Exception

mixed getState( string $property = null, mixed $default = null)

Method to get model state variables

Parameters

string $property Optional parameter name
mixed $default Optional default value

Return Value

mixed The property where specified, the state object where omitted

JTable getTable( string $name = '', string $prefix = 'Table', array $options = array())

Method to get a table object, load it if necessary.

Parameters

string $name The table name. Optional.
string $prefix The class prefix. Optional.
array $options Configuration array for model. Optional.

Return Value

JTable A \JTable object

Exceptions

Exception

boolean loadHistory( integer $version_id, JTable $table)

Method to load a row for editing from the version history table.

Parameters

integer $version_id Key to the version history table.
JTable $table &$table Content table object being loaded.

Return Value

boolean False on failure or error, true otherwise.

void setDbo( JDatabaseDriver $db)

Method to set the database driver object

Parameters

JDatabaseDriver $db A \JDatabaseDriver based object

Return Value

void

mixed setState( string $property, mixed $value = null)

Method to set model state variables

Parameters

string $property The name of the property.
mixed $value The value of the property to set or null.

Return Value

mixed The previous value of the property or null if not set.

boolean checkin( integer $pk = null)

Method to checkin a row.

Parameters

integer $pk The numeric id of the primary key.

Return Value

boolean False on failure or error, true otherwise.

boolean checkout( integer $pk = null)

Method to check-out a row for editing.

Parameters

integer $pk The numeric id of the primary key.

Return Value

boolean False on failure or error, true otherwise.

abstract JForm|boolean getForm( array $data = array(), boolean $loadData = true)

Abstract method for getting the form from the model.

Parameters

array $data Data for the form.
boolean $loadData True if the form is to load its own data (default case), false if not.

Return Value

JForm|boolean A \JForm object on success, false on failure

array|boolean validate( JForm $form, array $data, string $group = null)

Method to validate the form data.

Parameters

JForm $form The form to validate against.
array $data The data to validate.
string $group The name of the field group to validate.

Return Value

array|boolean Array of filtered data if valid, false otherwise.

See also

\JFormRule
\JFilterInput