Abstract Class JModelLegacy

Description

Base class for a Joomla Model

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

  • abstract:
  • since: 12.2

Located in /libraries/legacy/model/legacy.php (line 22)

JObject
   |
   --JModelLegacy
Direct descendents
Class Description
 class AdminModelHelp Admin Component Help Model
 class AdminModelSysInfo Model for the display of system information.
 class FinderModelIndexer Indexer model class for Finder.
 class FinderModelStatistics Statistics model class for Finder.
 class InstallerModelInstall Extension Manager Install Model
 class JoomlaupdateModelDefault Joomla! update overview Model
 class LanguagesModelStrings Languages Strings Model
 class LoginModelLogin Login Model
 class MediaModelList Media Component List Model
 class MediaModelManager Media Component Manager Model
 class MenusModelMenutypes Menu Item Types Model for Menus.
 class BannersModelBanner Banner model for the Joomla Banners component.
 class SearchModelSearch Search Component Search Model
Abstract class JModelForm Prototype form model.
Abstract class JModelItem Prototype item model.
 class JModelList Model class for handling lists of items.
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()])
 JModelLegacy __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()])
 boolean loadHistory (integer $version_id, JTable &$table)
 void populateState ()
 void setDbo (JDatabaseDriver $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 (JDatabaseQuery|string $query)
Variables
string $event_clean_cache = null (line 70)

The event to trigger when cleaning cache.

  • since: 12.2
  • access: protected
string $name (line 46)

The model (base) name

  • since: 12.2
  • access: protected
string $option = null (line 54)

The URL option for the component.

  • since: 12.2
  • access: protected

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

A state object

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

Database Connector

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

Indicates if the internal state has been set

  • since: 12.2
  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static addIncludePath (line 83)

Add a directory where JModelLegacy 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: 12.2
  • 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.
static addTablePath (line 129)

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

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

Returns a Model object, always creating it

  • return: A model object or false on failure
  • since: 12.2
  • 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 _createFileName (line 144)

Create the filename for a resource

  • return: The filename
  • since: 12.2
  • 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 209)

Constructor

  • since: 12.2
  • throws: Exception
  • access: public
JModelLegacy __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 557)

Clean the cache

  • since: 12.2
  • 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 369)

Method to get the database driver object

  • access: public
JDatabaseDriver getDbo ()
getName (line 385)

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: 12.2
  • throws: Exception
  • access: public
string getName ()
getState (line 410)

Method to get model state variables

  • return: property where specified, the state object where omitted
  • since: 12.2
  • 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 436)

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

  • return: A JTable object
  • since: 12.2
  • throws: Exception
  • 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:
loadHistory (line 461)

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

  • return: False on failure or error, true otherwise.
  • since: 12.2
  • access: public
boolean loadHistory (integer $version_id, JTable &$table)
  • integer $version_id: Key to the version history table.
  • JTable &$table: Content table object being loaded.
populateState (line 514)

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: 12.2
  • access: protected
void populateState ()

Redefined in descendants as:
setDbo (line 527)

Method to set the database driver object

  • since: 12.2
  • access: public
void setDbo (JDatabaseDriver $db)
setState (line 542)

Method to set model state variables

  • return: The previous value of the property or null if not set.
  • since: 12.2
  • 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 349)

Method to load and return a model object.

  • return: Model object or boolean false if failed
  • see: JTable::getInstance()
  • since: 12.2
  • 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: 12.2
  • throws: RuntimeException
  • 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: 12.2
  • access: protected
integer _getListCount (JDatabaseQuery|string $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()

Documentation generated on Tue, 19 Nov 2013 15:06:49 +0100 by phpDocumentor 1.4.3