Abstract Class JTable

Description

Implements interfaces:

Abstract Table class

Parent class to all tables.

Located in /libraries/joomla/table/table.php (line 25)

JObject
   |
   --JTable
Direct descendents
Class Description
 class BannersTableBanner Banner table
 class BannersTableClient Client table
 class ContactTableContact
 class ContentTableFeatured
 class FinderTableFilter Filter table class for the Finder package.
 class FinderTableLink Link table class for the Finder package.
 class FinderTableMap Map table class for the Finder package.
 class MessagesTableMessage Message Table class
 class NewsfeedsTableNewsfeed
 class RedirectTableLink Link Table for Redirect.
 class TemplatesTableStyle Template style table class.
 class UsersTableNote User notes table class
 class WeblinksTableWeblink Weblink Table class
 class JTableContenthistory Content History table.
 class JTableContenttype Tags table
 class JTableCorecontent Core content table
 class JTableUcm UCM map table
 class JTableExtension Extension table Replaces plugins table
 class JTableLanguage Languages table.
 class JTableNested Table class supporting modified pre-order tree traversal behavior.
 class JTableUpdate Update table Stores updates temporarily
 class JTableUser Users table
 class JTableUsergroup Usergroup table class.
 class JTableViewlevel Viewlevels table class.
 class JTableContent Content table
 class JTableMenuType Menu Types table
 class JTableModule Module table
 class JTableSession Session table
Variable Summary
Method Summary
 static array addIncludePath ([mixed $path = null])
 static mixed getInstance (string $type, [string $prefix = 'JTable'], [array $config = array()])
 JTable __construct (string $table, mixed $key, JDatabaseDriver $db)
 void appendPrimaryKeys (JDatabaseQuery $query, [mixed $pk = null])
 boolean bind (mixed $src, [mixed $ignore = array()])
 boolean check ()
 boolean checkIn ([mixed $pk = null])
 boolean checkOut (integer $userId, [mixed $pk = null])
 boolean delete ([mixed $pk = null])
 mixed getFields ()
 mixed getKeyName ([boolean $multiple = false])
 mixed getNextOrder ([string $where = ''])
 JTableObserver|null getObserverOfClass (string $observerClass)
 array getPrimaryKey ([array $keys = array()])
 string getTableName ()
 boolean hasPrimaryKey ()
 boolean hit ([mixed $pk = null])
 boolean isCheckedOut ([integer $with = 0], [integer $against = null])
 boolean load ([mixed $keys = null], [boolean $reset = true])
 mixed move (integer $delta, [string $where = ''])
 boolean publish ([mixed $pks = null], [integer $state = 1], [integer $userId = 0])
 mixed reorder ([string $where = ''])
 void reset ()
 boolean save (mixed $src, [string $orderingFilter = ''], [mixed $ignore = ''])
 boolean setDBO (JDatabaseDriver $db)
 void setRules (mixed $input)
 boolean store ([boolean $updateNulls = false])
 string _getAssetName ()
 integer _getAssetParentId ([JTable $table = null], [integer $id = null])
 string _getAssetTitle ()
 boolean _lock ()
 boolean _unlock ()
Variables
boolean $_autoincrement = true (line 97)

Indicates that the primary keys autoincrement.

  • since: 12.3
  • access: protected
JDatabaseDriver $_db (line 65)

JDatabaseDriver object.

  • since: 11.1
  • access: protected
boolean $_locked = false (line 89)

Indicator that the tables have been locked.

  • since: 11.1
  • access: protected
JObserverUpdater $_observers (line 105)

Generic observers for this JTable (Used e.g. for tags Processing)

  • since: 3.1.2
  • access: protected
JAccessRules $_rules (line 81)

The rules associated with this record.

  • var: A JAccessRules object.
  • since: 11.1
  • access: protected
string $_tbl = '' (line 41)

Name of the database table to model.

  • since: 11.1
  • access: protected
string $_tbl_key = '' (line 49)

Name of the primary key field in the table.

  • since: 11.1
  • access: protected
array $_tbl_keys = array() (line 57)

Name of the primary key fields in the table.

  • since: 12.2
  • access: protected
boolean $_trackAssets = false (line 73)

Should rows be tracked as ACL assets?

  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JObject

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

Add a filesystem path where JTable should search for table class files.

You may either pass a string or an array of paths.

static array addIncludePath ([mixed $path = null])
  • mixed $path: A filesystem path or array of filesystem paths to add.
static getInstance (line 256)

Static method to get an instance of a JTable class if it can be found in the table include paths. To add include paths for searching for JTable classes see JTable::addIncludePath().

static mixed getInstance (string $type, [string $prefix = 'JTable'], [array $config = array()])
  • string $type: The type (name) of the JTable class to get an instance of.
  • string $prefix: An optional prefix for the table class name.
  • array $config: An optional array of configuration values for the JTable object.
Constructor __construct (line 118)

Object constructor to set table and key fields. In most cases this will be overridden by child classes to explicitly set the table and key fields for a particular database table.

  • since: 11.1
  • access: public
JTable __construct (string $table, mixed $key, JDatabaseDriver $db)
  • string $table: Name of the table to model.
  • mixed $key: Name of the primary key field in the table or array of field names that compose the primary key.
  • JDatabaseDriver $db: JDatabaseDriver object.

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

Redefined in descendants as:
appendPrimaryKeys (line 415)

Method to append the primary keys for this table to a query.

  • since: 12.3
  • access: public
void appendPrimaryKeys (JDatabaseQuery $query, [mixed $pk = null])
  • JDatabaseQuery $query: A query object to append.
  • mixed $pk: Optional primary key parameter.
attachObserver (line 194)

Implement JObservableInterface: Adds an observer to this instance.

This method will be called fron the constructor of classes implementing JObserverInterface which is instanciated by the constructor of $this with JObserverMapper::attachAllObservers($this)

  • since: 3.1.2
  • access: public
void attachObserver (JObserverInterface $observer)

Implementation of:
JObservableInterface::attachObserver()
Adds an observer to this JObservableInterface instance.
bind (line 587)

Method to bind an associative array or object to the JTable instance.This method only binds properties that are publicly accessible and optionally takes an array of properties to ignore when binding.

boolean bind (mixed $src, [mixed $ignore = array()])
  • mixed $src: An associative array or object to bind to the JTable instance.
  • mixed $ignore: An optional array or space separated list of properties to ignore while binding.

Redefined in descendants as:
check (line 735)

Method to perform sanity checks on the JTable instance properties to ensure they are safe to store in the database. Child classes should override this method to make sure the data they are storing in the database is safe and as expected before storage.

boolean check ()

Redefined in descendants as:
checkIn (line 1081)

Method to check a row in if the necessary properties/fields exist. Checking a row in will allow other users the ability to edit the row.

boolean checkIn ([mixed $pk = null])
  • mixed $pk: An optional primary key value to check out. If not set the instance property value is used.
checkOut (line 1018)

Method to check a row out if the necessary properties/fields exist. To prevent race conditions while editing rows in a database, a row can be checked out if the fields 'checked_out' and 'checked_out_time' are available.

While a row is checked out, any attempt to store the row by a user other than the one who checked the row out should be held until the row is checked in again.

boolean checkOut (integer $userId, [mixed $pk = null])
  • integer $userId: The Id of the user checking out the row.
  • mixed $pk: An optional primary key value to check out. If not set the instance property value is used.
delete (line 930)

Method to delete a row from the database table by primary key value.

boolean delete ([mixed $pk = null])
  • mixed $pk: An optional primary key value to delete. If not set the instance property value is used.

Redefined in descendants as:
getDbo (line 492)

Method to get the JDatabaseDriver object.

JDatabaseDriver getDbo ()
getFields (line 221)

Get the columns from database table.

  • return: An array of the field names, or false if an error occurs.
  • since: 11.1
  • throws: UnexpectedValueException
  • access: public
mixed getFields ()
getKeyName (line 464)

Method to get the primary key field name for the table.

mixed getKeyName ([boolean $multiple = false])
  • boolean $multiple: True to return all primary keys (as an array) or false to return just the first one (as a string).
getNextOrder (line 1278)

Method to get the next ordering value for a group of rows defined by an SQL WHERE clause.

This is useful for placing a new item last in a group of items in the table.

mixed getNextOrder ([string $where = ''])
  • string $where: WHERE clause to use for selecting the MAX(ordering) for the table.
getObserverOfClass (line 208)

Gets the instance of the observer of class $observerClass

  • since: 3.1.2
  • access: public
JTableObserver|null getObserverOfClass (string $observerClass)
  • string $observerClass: The observer class-name to return the object of
getPrimaryKey (line 1312)

Get the primary key values for this table using passed in values as a default.

  • return: An array of primary key names and values.
  • since: 12.3
  • access: public
array getPrimaryKey ([array $keys = array()])
  • array $keys: Optional primary key values to use.
getRules (line 542)

Method to get the rules for the record.

  • return: object
  • since: 11.1
  • access: public
JAccessRules getRules ()
getTableName (line 449)

Method to get the database table name for the class.

string getTableName ()
hasPrimaryKey (line 1138)

Validate that the primary key has been set.

  • return: True if the primary key(s) have been set.
  • since: 12.3
  • access: public
boolean hasPrimaryKey ()
hit (line 1183)

Method to increment the hits for a row if the necessary property/field exists.

boolean hit ([mixed $pk = null])
  • mixed $pk: An optional primary key value to increment. If not set the instance property value is used.
isCheckedOut (line 1244)

Method to determine if a row is checked out and therefore uneditable by a user. If the row is checked out by the same user, then it is considered not checked out -- as the user can still edit it.

boolean isCheckedOut ([integer $with = 0], [integer $against = null])
  • integer $with: The userid to preform the match with, if an item is checked out by this user the function will return false.
  • integer $against: The userid to perform the match against when the function is used as a static function.
load (line 639)

Method to load a row from the database by primary key and bind the fields to the JTable instance properties.

  • return: True if successful. False if row not found.
  • link: http://docs.joomla.org/JTable/load
  • throws: InvalidArgumentException
  • throws: RuntimeException
  • throws: UnexpectedValueException
  • since: 11.1
  • access: public
boolean load ([mixed $keys = null], [boolean $reset = true])
  • mixed $keys: An optional primary key value to load the row by, or an array of fields to match. If not set the instance property value is used.
  • boolean $reset: True to reset the default values before loading the new row.

Redefined in descendants as:
  • JTableUser::load() : Method to load a user, user groups, and any other necessary data from the database so that it can be bound to the user object.
move (line 1403)

Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.

Negative numbers move the row up in the sequence and positive numbers move it down.

mixed move (integer $delta, [string $where = ''])
  • integer $delta: The direction and magnitude to move the row in the ordering sequence.
  • string $where: WHERE clause to use for limiting the selection of rows to compact the ordering values.

Redefined in descendants as:
  • JTableNested::move() : Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.
publish (line 1499)

Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.

boolean publish ([mixed $pks = null], [integer $state = 1], [integer $userId = 0])
  • mixed $pks: An optional array of primary key values to update. If not set the instance property value is used.
  • integer $state: The publishing state. eg. [0 = unpublished, 1 = published]
  • integer $userId: The user id of the user performing the operation.

Redefined in descendants as:
  • BannersTableBanner::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • BannersTableClient::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • FinderTableFilter::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • FinderTableMap::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • MessagesTableMessage::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • UsersTableNote::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to check-in rows that it can after adjustments are made.
  • WeblinksTableWeblink::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • JTableCorecontent::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • JTableExtension::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
  • JTableNested::publish() : Method to set the publishing state for a node or list of nodes in the database
  • JTableContent::publish() : Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
reorder (line 1340)

Method to compact the ordering values of rows in a group of rows defined by an SQL WHERE clause.

mixed reorder ([string $where = ''])
  • string $where: WHERE clause to use for limiting the selection of rows to compact the ordering values.
reset (line 557)

Method to reset class properties to the defaults set in the class definition. It will ignore the primary key as well as any private class properties (except $_errors).

void reset ()
save (line 880)

Method to provide a shortcut to binding, checking and storing a JTable

instance to the database table. The method will check a row in once the data has been stored and if an ordering filter is present will attempt to reorder the table rows based on the filter. The ordering filter is an instance property name. The rows that will be reordered are those whose value matches the JTable instance for the property specified.

boolean save (mixed $src, [string $orderingFilter = ''], [mixed $ignore = ''])
  • mixed $src: An associative array or object to bind to the JTable instance.
  • string $orderingFilter: Filter for the order updating
  • mixed $ignore: An optional array or space separated list of properties to ignore while binding.
setDBO (line 507)

Method to set the JDatabaseDriver object.

boolean setDBO (JDatabaseDriver $db)
  • JDatabaseDriver $db: A JDatabaseDriver object to be used by the table object.
setRules (line 523)

Method to set rules for the record.

  • since: 11.1
  • access: public
void setRules (mixed $input)
  • mixed $input: A JAccessRules object, JSON string, or array.
store (line 754)

Method to store a row in the database from the JTable instance properties.

If a primary key value is set the row with that primary key value will be updated with the instance property values. If no primary key value is set a new row will be inserted into the database with the properties from the JTable instance.

boolean store ([boolean $updateNulls = false])
  • boolean $updateNulls: True to update fields even if they are null.

Redefined in descendants as:
_getAssetName (line 348)

Method to compute the default name of the asset.

The default name is in the form table_name.id where id is the value of the primary key of the table.

  • since: 11.1
  • access: protected
string _getAssetName ()

Redefined in descendants as:
_getAssetParentId (line 391)

Method to get the parent asset under which to register this one.

By default, all assets are registered to the ROOT node with ID, which will default to 1 if none exists. The extended class can define a table and id to lookup. If the asset does not exist it will be created.

  • since: 11.1
  • access: protected
integer _getAssetParentId ([JTable $table = null], [integer $id = null])
  • JTable $table: A JTable object for the asset parent.
  • integer $id: Id to look up

Redefined in descendants as:
_getAssetTitle (line 372)

Method to return the title to use for the asset table. In

tracking the assets a title is kept for each asset so that there is some context available in a unified access manager. Usually this would just return $this->title or $this->name or whatever is being used for the primary name of the row. If this method is not overridden, the asset name is used.

string _getAssetTitle ()

Redefined in descendants as:
_lock (line 1597)

Method to lock the database table for writing.

  • return: True on success.
  • since: 11.1
  • throws: RuntimeException
  • access: protected
boolean _lock ()
_unlock (line 1612)

Method to unlock the database table for writing.

  • return: True on success.
  • since: 11.1
  • access: protected
boolean _unlock ()

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:14:51 +0100 by phpDocumentor 1.4.3