Joomla! 1.5 API

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2011 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.

Abstract 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: 1.5

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

Class JObject   (Subpackage Base)

Abstract class JModel   (Subpackage Application)
Variable Summary
Variable object $_db
Variable string $_name
Variable string $_state
Method Summary
Static method static void addTablePath (string|array $path)
Constructor JModel __construct ([ $config = array()])
Method array addIncludePath ([string $path = ''])
Method mixed &getInstance (string $type, [string $prefix = ''], [array $config = array()])
Method string getName ()
Method object The getState ([string $property = null])
Method object The &getTable ([string $name = ''], [string $prefix = 'Table'], [array $options = array()])
Method void setDBO ( &$db, object $db)
Method mixed setState (string $property, [mixed $value = null])
Method array &_getList (string $query, [int $limitstart = 0], [int $limit = 0])
Method int _getListCount (string $query)
Variables
object $_db (line 45)

Database Connector

  • access: protected
string $_name (line 37)

The model (base) name

  • access: protected
string $_state (line 53)

An state object

  • access: protected

Inherited Variables

Inherited from JObject

Variable JObject::$_errors
Methods
Constructor __construct (line 60)

Constructor

  • since: 1.5
JModel __construct ([ $config = array()])
  • $config

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

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
  • since: 1.5
  • access: public
array addIncludePath ([string $path = ''])
  • string $path: A path to search.
addTablePath (line 265)

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

void addTablePath (string|array $path)
  • string|array $path: The directory (-ies) to add.
getDBO (line 167)

Method to get the database connector object

  • return: connector object
  • since: 1.5
  • access: public
object JDatabase &getDBO ()
getInstance (line 103)

Returns a reference to the a Model object, always creating it

  • return: A model object, or false on failure
  • since: 1.5
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.
getName (line 194)

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: 1.5
  • access: public
string getName ()
getState (line 155)

Method to get model state variables

  • return: property where specified, the state object where omitted
  • since: 1.5
  • access: public
object The getState ([string $property = null])
  • string $property: Optional parameter name
getTable (line 220)

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

  • return: table
  • since: 1.5
  • access: public
object The &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.
setDBO (line 179)

Method to set the database connector object

  • since: 1.5
void setDBO ( &$db, object $db)
  • object $db: A JDatabase based object
  • &$db
setState (line 142)

Method to set model state variables

  • return: The previous value of the property
  • since: 1.5
  • 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
_getList (line 281)

Returns an object list

  • since: 1.5
  • access: protected
array &_getList (string $query, int $limitstart, int $limit)
  • string $query: The query
  • int $limitstart: Offset
  • int $limit: The number of records
_getListCount (line 297)

Returns a record count for the query

  • since: 1.5
  • access: protected
int _getListCount (string $query)
  • string $query: The query

Inherited Methods

Inherited From JObject

 JObject::JObject()
 JObject::__construct()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::getPublicProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::toString()
Support Joomla!