Class JModel

Description

Base class for a Joomla Model

Acts as a Factory class for application specific objects and provides many supporting API functions.

  • abstract:
  • since: 11.1

Located in /libraries/joomla/application/component/model.php (line 22)

JObject
   |
   --JModel
Direct descendents
Class Description
AdminModelSysInfo
AdminModelHelp Admin Component Help Model
LanguagesModelStrings Languages Strings Model
InstallerModelInstall Extension Manager Install Model
TemplatesModelTemplate
FinderModelStatistics Statistics model class for Finder.
FinderModelIndexer Indexer model class for Finder.
MediaModelList Media Component List Model
MediaModelManager Media Component Manager Model
JoomlaupdateModelDefault Joomla! update overview Model
MenusModelMenutypes Menu Item Types Model for Menus.
LoginModelLogin Login Model
JModelList Model class for handling lists of items.
JModelForm Prototype form model.
JModelItem Prototype item model.
JModelLegacy Alias to JModel for forward compatability.
Variable Summary
string $name
string $option
string $state
object $_db
boolean $__state_set
Method Summary
static array addIncludePath ([mixed $path = ''], [string $prefix = ''])
static void addTablePath (mixed $path)
static mixed getInstance (string $type, [string $prefix = ''], [array $config = array()])
static string _createFileName (string $type, [array $parts = array()])
JModel __construct ([array $config = array()])
void cleanCache ([string $group = null], [integer $client_id = 0])
string getName ()
object The getState ([string $property = null], [mixed $default = null])
JTable getTable ([string $name = ''], [string $prefix = 'Table'], [array $options = array()])
void populateState ()
void setDbo (JDatabase &$db)
mixed setState (string $property, [mixed $value = null])
mixed _createTable (string $name, [string $prefix = 'Table'], [array $config = array()])
array _getList (string $query, [integer $limitstart = 0], [integer $limit = 0])
integer _getListCount (string $query)
Variables
string $event_clean_cache = null (line 72)

The event to trigger when cleaning cache.

  • since: 11.1
  • access: protected
string $name (line 47)

The model (base) name

  • since: 11.1
  • access: protected
string $option = null (line 55)

The URL option for the component.

  • since: 11.1
  • access: protected

Redefined in descendants as:
string $state (line 64)

A state object

  • since: 11.1
  • access: protected
object $_db (line 38)

Database Connector

  • since: 11.1
  • access: protected
boolean $__state_set = null (line 30)

Indicates if the internal state has been set

  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static method addIncludePath (line 85)

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

  • return: An array with directory elements. If prefix is equal to '', all directories are returned.
  • since: 11.1
  • access: public
static array addIncludePath ([mixed $path = ''], [string $prefix = ''])
  • mixed $path: A path or array[sting] of paths to search.
  • string $prefix: A prefix for models.

Redefined in descendants as:
static method addTablePath (line 131)

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

  • since: 11.1
  • access: public
static void addTablePath (mixed $path)
  • mixed $path: The directory as a string or directories as an array to add.
static method getInstance (line 172)

Returns a Model object, always creating it

  • return: A model object or false on failure
  • since: 11.1
  • access: public
static mixed getInstance (string $type, [string $prefix = ''], [array $config = array()])
  • string $type: The model type to instantiate
  • string $prefix: Prefix for the model class name. Optional.
  • array $config: Configuration array for model. Optional.
static method _createFileName (line 147)

Create the filename for a resource

  • return: The filename
  • since: 11.1
  • access: protected
static string _createFileName (string $type, [array $parts = array()])
  • string $type: The resource type to create the filename for.
  • array $parts: An associative array of filename information.
Constructor __construct (line 211)

Constructor

  • since: 11.1
  • access: public
JModel __construct ([array $config = array()])
  • array $config: An array of configuration options (name, state, dbo, table_path, ignore_request).

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.

Redefined in descendants as:
cleanCache (line 492)

Clean the cache

  • since: 11.1
  • access: protected
void cleanCache ([string $group = null], [integer $client_id = 0])
  • string $group: The cache group
  • integer $client_id: The ID of the client

Redefined in descendants as:
getDbo (line 355)

Method to get the database driver object

  • access: public
JDatabase getDbo ()
getName (line 370)

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: The name of the model
  • since: 11.1
  • access: public
string getName ()
getState (line 395)

Method to get model state variables

  • return: property where specified, the state object where omitted
  • since: 11.1
  • access: public
object The getState ([string $property = null], [mixed $default = null])
  • string $property: Optional parameter name
  • mixed $default: Optional default value

Redefined in descendants as:
getTable (line 420)

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

  • return: A JTable object
  • since: 11.1
  • access: public
JTable getTable ([string $name = ''], [string $prefix = 'Table'], [array $options = array()])
  • string $name: The table name. Optional.
  • string $prefix: The class prefix. Optional.
  • array $options: Configuration array for model. Optional.

Redefined in descendants as:
populateState (line 449)

Method to auto-populate the model state.

This method should only be called once per instantiation and is designed to be called on the first call to the getState() method unless the model configuration flag to ignore the request is set.

  • since: 11.1
  • access: protected
void populateState ()

Redefined in descendants as:
setDbo (line 462)

Method to set the database driver object

  • since: 11.1
  • access: public
void setDbo (JDatabase &$db)
setState (line 477)

Method to set model state variables

  • return: The previous value of the property or null if not set.
  • since: 11.1
  • access: public
mixed setState (string $property, [mixed $value = null])
  • string $property: The name of the property.
  • mixed $value: The value of the property to set or null.
_createTable (line 335)

Method to load and return a model object.

  • return: Model object or boolean false if failed
  • see: JTable::getInstance
  • since: 11.1
  • access: protected
mixed _createTable (string $name, [string $prefix = 'Table'], [array $config = array()])
  • string $name: The name of the view
  • string $prefix: The class prefix. Optional.
  • array $config: Configuration settings to pass to JTable::getInstance
_getList (line 298)

Gets an array of objects from the results of database query.

  • return: An array of results.
  • since: 11.1
  • access: protected
array _getList (string $query, [integer $limitstart = 0], [integer $limit = 0])
  • string $query: The query.
  • integer $limitstart: Offset.
  • integer $limit: The number of records.

Redefined in descendants as:
_getListCount (line 315)

Returns a record count for the query

  • return: Number of rows for query
  • since: 11.1
  • access: protected
integer _getListCount (string $query)
  • string $query: The query.

Inherited Methods

Inherited From JObject

JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()

Documentation generated on Mon, 25 Jun 2012 13:57:24 -0500 by phpDocumentor 1.4.4