Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe Table
+ Graphe d'héritage de Table:

Fonctions membres publiques

 __construct ($table, $key, $db)
 
 attachObserver (\JObserverInterface $observer)
 
 getObserverOfClass ($observerClass)
 
 getFields ($reload=false)
 
 appendPrimaryKeys ($query, $pk=null)
 
 getTableName ()
 
 getKeyName ($multiple=false)
 
 getDbo ()
 
 setDbo ($db)
 
 setRules ($input)
 
 getRules ()
 
 reset ()
 
 bind ($src, $ignore=array())
 
 load ($keys=null, $reset=true)
 
 check ()
 
 save ($src, $orderingFilter='', $ignore='')
 
 checkOut ($userId, $pk=null)
 
 checkIn ($pk=null)
 
 hasPrimaryKey ()
 
 hit ($pk=null)
 
 isCheckedOut ($with=0, $against=null)
 
 getNextOrder ($where='')
 
 getPrimaryKey (array $keys=array())
 
 reorder ($where='')
 
 move ($delta, $where='')
 
 publish ($pks=null, $state=1, $userId=0)
 
 getColumnAlias ($column)
 
 setColumnAlias ($column, $columnAlias)
 
 hasField ($key)
 
- Fonctions membres publiques hérités de JObservableInterface
 attachObserver (JObserverInterface $observer)
 

Fonctions membres publiques statiques

static getInstance ($type, $prefix='JTable', $config=array())
 
static addIncludePath ($path=null)
 

Fonctions membres protégées

 _getAssetName ()
 
 _getAssetTitle ()
 
 _lock ()
 
 _unlock ()
 

Attributs protégés

 $_tbl = ''
 
 $_tbl_key = ''
 
 $_tbl_keys = array()
 
 $_db
 
 $_trackAssets = false
 
 $_rules
 
 $_locked = false
 
 $_autoincrement = true
 
 $_observers
 
 $_columnAlias = array()
 
 $_jsonEncode = array()
 
 $_supportNullValue = false
 

Attributs privés statiques

static $_includePaths = array()
 
static $tableFields
 

Description détaillée

Abstract Table class

Parent class to all tables.

Depuis
1.7.0 Joomla.Platform/jtable.cls

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $table,
  $key,
  $db 
)

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.

Paramètres
string$tableName of the table to model.
mixed$keyName of the primary key field in the table or array of field names that compose the primary key.
\JDatabaseDriver$dbobject.
Depuis
1.7.0

Références $db, $fields, $key, $name, elseif, et null.

Documentation des fonctions membres

◆ _getAssetName()

_getAssetName ( )
protected

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.

Renvoie
string
Depuis
1.7.0

◆ _getAssetTitle()

_getAssetTitle ( )
protected

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.

Renvoie
string The string to use as the title in the asset table.
Depuis
1.7.0

◆ _lock()

_lock ( )
protected

Method to lock the database table for writing.

Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

◆ _unlock()

_unlock ( )
protected

Method to unlock the database table for writing.

Renvoie
boolean True on success.
Depuis
1.7.0

◆ addIncludePath()

static addIncludePath (   $path = null)
static

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

Paramètres
array | string$pathA filesystem path or array of filesystem paths to add.
Renvoie
array An array of filesystem paths to find Table classes in.
Depuis
1.7.0

Références $path.

Référencé par TagsHelper\createTagsFromField(), TagsHelper\createTagsFromMetadata(), TagsHelper\getTagTreeArray(), et TagsHelper\searchTags().

◆ appendPrimaryKeys()

appendPrimaryKeys (   $query,
  $pk = null 
)

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

Paramètres
\JDatabaseQuery$queryA query object to append.
mixed$pkOptional primary key parameter.
Renvoie
void
Depuis
3.1.4

Références $query.

◆ attachObserver()

attachObserver ( \JObserverInterface  $observer)

Implement : Adds an observer to this instance. This method will be called fron the constructor of classes implementing which is instanciated by the constructor of $this with ::attachAllObservers($this)

Paramètres
\JObserverInterface | \JTableObserver$observerThe observer object
Renvoie
void
Depuis
3.1.2

◆ bind()

bind (   $src,
  $ignore = array() 
)

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

Paramètres
array | object$srcAn associative array or object to bind to the Table instance.
array | string$ignoreAn optional array or space separated list of properties to ignore while binding.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $field, et json_encode.

◆ check()

check ( )

Method to perform sanity checks on the Table 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.

Renvoie
boolean True if the instance is sane and able to be stored in the database.
Depuis
1.7.0

◆ checkIn()

checkIn (   $pk = null)

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.

Paramètres
mixed$pkAn optional primary key value to check out. If not set the instance property value is used.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $dispatcher, $key, $query, elseif, JEventDispatcher\getInstance(), et null.

◆ checkOut()

checkOut (   $userId,
  $pk = null 
)

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.

Paramètres
integer$userIdThe Id of the user checking out the row.
mixed$pkAn optional primary key value to check out. If not set the instance property value is used.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $key, $query, $userId, elseif, et null.

◆ getColumnAlias()

getColumnAlias (   $column)

Method to return the real name of a "special" column such as ordering, hits, published etc etc. In this way you are free to follow your db naming convention and use the built in functions.

Paramètres
string$columnName of the "special" column (ie ordering, hits)
Renvoie
string The string that identify the special
Depuis
3.4

Références $return.

◆ getDbo()

getDbo ( )

Method to get the object.

Renvoie
The internal database driver object.
Depuis
1.7.0

◆ getFields()

getFields (   $reload = false)

Get the columns from database table.

Paramètres
bool$reloadflag to reload cache
Renvoie
mixed An array of the field names, or false if an error occurs.
Depuis
1.7.0
Exceptions

Références $fields, $key, et $name.

◆ getInstance()

static getInstance (   $type,
  $prefix = 'JTable',
  $config = array() 
)
static

Static method to get an instance of a Table class if it can be found in the table include paths.

To add include paths for searching for Table classes see Table::addIncludePath().

Paramètres
string$typeThe type (name) of the Table class to get an instance of.
string$prefixAn optional prefix for the table class name.
array$configAn optional array of configuration values for the Table object.
Renvoie
Table|boolean A Table object if found or boolean false on failure.
Depuis
1.7.0

Références $config, $db, $prefix, $type, et jimport().

Référencé par UCMContent\__construct(), InstallerAdapter\__construct(), Installer\__construct(), Language\_getAssetParentId(), MenuType\_getAssetParentId(), LanguageAdapter\_install(), ExtensionAdapter\_startElement(), CollectionAdapter\_startElement(), InstallerAdapter\canUninstallPackageChild(), LibraryAdapter\checkExtensionInFilesystem(), LegacyFactory\createTable(), TagsHelper\createTagsFromField(), TagsHelper\createTagsFromMetadata(), MenuType\delete(), CoreContent\delete(), Nested\delete(), ContentHistoryHelper\deleteHistory(), ModuleAdapter\discover(), LibraryAdapter\discover(), TemplateAdapter\discover(), PluginAdapter\discover(), LanguageAdapter\discover(), ComponentAdapter\discover(), FileAdapter\finaliseInstall(), ModuleAdapter\finaliseInstall(), ContenthistoryField\getLayoutData(), User\getTable(), TagsHelper\getTagTreeArray(), TagsHelper\postStoreProcess(), TagsHelper\searchTags(), Language\store(), ContentType\store(), UCMBase\store(), ContentHistory\store(), MenuType\store(), ContentHistoryHelper\store(), Menu\store(), UCMContent\store(), Category\store(), Content\store(), FileAdapter\uninstall(), LibraryAdapter\uninstall(), TemplateAdapter\uninstall(), PluginAdapter\uninstall(), PackageAdapter\uninstall(), LanguageAdapter\uninstall(), ComponentAdapter\uninstall(), Updater\update(), LanguageAdapter\update(), et ToolbarHelper\versions().

◆ getKeyName()

getKeyName (   $multiple = false)

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

Paramètres
boolean$multipleTrue to return all primary keys (as an array) or false to return just the first one (as a string).
Renvoie
mixed Array of primary key field names or string containing the first primary key field.
Depuis
1.7.0

◆ getNextOrder()

getNextOrder (   $where = '')

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.

Paramètres
string$whereWHERE clause to use for selecting the MAX(ordering) for the table.
Renvoie
integer The next ordering value.
Depuis
1.7.0
Exceptions

Références $query.

◆ getObserverOfClass()

getObserverOfClass (   $observerClass)

Gets the instance of the observer of class $observerClass

Paramètres
string$observerClassThe observer class-name to return the object of
Renvoie
|null
Depuis
3.1.2

◆ getPrimaryKey()

getPrimaryKey ( array  $keys = array())

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

Paramètres
array$keysOptional primary key values to use.
Renvoie
array An array of primary key names and values.
Depuis
3.1.4

Références $key.

◆ getRules()

getRules ( )

Method to get the rules for the record.

Renvoie
object
Depuis
1.7.0

◆ getTableName()

getTableName ( )

Method to get the database table name for the class.

Renvoie
string The name of the database table being modeled.
Depuis
1.7.0

◆ hasField()

hasField (   $key)

Check if the record has a property (applying a column alias if it exists)

Paramètres
string$keykey to be checked
Renvoie
boolean
Depuis
3.9.11

Références $key.

◆ hasPrimaryKey()

hasPrimaryKey ( )

Validate that the primary key has been set.

Renvoie
boolean True if the primary key(s) have been set.
Depuis
3.1.4

Références $count, $key, et $query.

◆ hit()

hit (   $pk = null)

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

Paramètres
mixed$pkAn optional primary key value to increment. If not set the instance property value is used.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $key, $query, elseif, et null.

◆ isCheckedOut()

isCheckedOut (   $with = 0,
  $against = null 
)

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.

Paramètres
integer$withThe user ID to preform the match with, if an item is checked out by this user the function will return false.
integer$againstThe user ID to perform the match against when the function is used as a static function.
Renvoie
boolean True if checked out.
Depuis
1.7.0

Références $db, et $query.

◆ load()

load (   $keys = null,
  $reset = true 
)

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

Paramètres
mixed$keysAn 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$resetTrue to reset the default values before loading the new row.
Renvoie
boolean True if successful. False if row not found.
Depuis
1.7.0
Exceptions

Références $field, $fields, $key, $query, $row, $value, et elseif.

◆ move()

move (   $delta,
  $where = '' 
)

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.

Paramètres
integer$deltaThe direction and magnitude to move the row in the ordering sequence.
string$whereWHERE clause to use for limiting the selection of rows to compact the ordering values.
Renvoie
boolean True on success.
Depuis
1.7.0
Exceptions

Références $query, $row, elseif, et null.

◆ publish()

publish (   $pks = null,
  $state = 1,
  $userId = 0 
)

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.

Paramètres
mixed$pksAn optional array of primary key values to update. If not set the instance property value is used.
integer$stateThe publishing state. eg. [0 = unpublished, 1 = published]
integer$userIdThe user ID of the user performing the operation.
Renvoie
boolean True on success; false if $pks is empty.
Depuis
1.7.0

Références $key, $query, $state, et $userId.

◆ reorder()

reorder (   $where = '')

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

Paramètres
string$whereWHERE clause to use for limiting the selection of rows to compact the ordering values.
Renvoie
mixed Boolean True on success.
Depuis
1.7.0
Exceptions

Références $i, et $query.

◆ reset()

reset ( )

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).

Renvoie
void
Depuis
1.7.0

◆ save()

save (   $src,
  $orderingFilter = '',
  $ignore = '' 
)

Method to provide a shortcut to binding, checking and storing a Table 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 Table instance for the property specified.

Paramètres
array | object$srcAn associative array or object to bind to the Table instance.
string$orderingFilterFilter for the order updating
array | string$ignoreAn optional array or space separated list of properties to ignore while binding.
Renvoie
boolean True on success.
Depuis
1.7.0

◆ setColumnAlias()

setColumnAlias (   $column,
  $columnAlias 
)

Method to register a column alias for a "special" column.

Paramètres
string$columnThe "special" column (ie ordering)
string$columnAliasThe real column name (ie foo_ordering)
Renvoie
void
Depuis
3.4

◆ setDbo()

setDbo (   $db)

Method to set the object.

Paramètres
\JDatabaseDriver$dbA object to be used by the table object.
Renvoie
boolean True on success.
Depuis
1.7.0

Références $db.

◆ setRules()

setRules (   $input)

Method to set rules for the record.

Paramètres
mixed$inputA object, JSON string, or array.
Renvoie
void
Depuis
1.7.0

Références $input.

Documentation des champs

◆ $_autoincrement

$_autoincrement = true
protected

◆ $_columnAlias

$_columnAlias = array()
protected

◆ $_db

$_db
protected

◆ $_includePaths

$_includePaths = array()
staticprivate

◆ $_jsonEncode

$_jsonEncode = array()
protected

◆ $_locked

$_locked = false
protected

◆ $_observers

$_observers
protected

◆ $_rules

$_rules
protected

◆ $_supportNullValue

$_supportNullValue = false
protected

◆ $_tbl

$_tbl = ''
protected

◆ $_tbl_key

$_tbl_key = ''
protected

◆ $_tbl_keys

$_tbl_keys = array()
protected

◆ $_trackAssets

$_trackAssets = false
protected

◆ $tableFields

$tableFields
staticprivate

La documentation de cette classe a été générée à partir du fichier suivant :