[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Table/ -> Table.php (summary)

Joomla! Content Management System

Copyright: (C) 2005 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 1858 lines (59 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 37 functions

  __construct()
  getFields()
  getInstance()
  addIncludePath()
  _getAssetName()
  _getAssetTitle()
  _getAssetParentId()
  appendPrimaryKeys()
  getTableName()
  getKeyName()
  getId()
  getDbo()
  setDbo()
  setRules()
  getRules()
  reset()
  bind()
  load()
  check()
  store()
  save()
  delete()
  checkOut()
  checkIn()
  hasPrimaryKey()
  hit()
  isCheckedOut()
  getNextOrder()
  getPrimaryKey()
  reorder()
  move()
  publish()
  _lock()
  getColumnAlias()
  setColumnAlias()
  _unlock()
  hasField()

Functions
Functions that are not part of a class:

__construct($table, $key, DatabaseDriver $db, DispatcherInterface $dispatcher = null)   X-Ref
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: string               $table       Name of the table to model.
param: mixed                $key         Name of the primary key field in the table or array of field names that compose the primary key.
param: DatabaseDriver       $db          DatabaseDriver object.
param: DispatcherInterface  $dispatcher  Event dispatcher for this table

getFields($reload = false)   X-Ref
Get the columns from database table.

param: bool  $reload  flag to reload cache
return: mixed  An array of the field names, or false if an error occurs.

getInstance($type, $prefix = 'JTable', $config = array()   X-Ref
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: string  $type    The type (name) of the Table class to get an instance of.
param: string  $prefix  An optional prefix for the table class name.
param: array   $config  An optional array of configuration values for the Table object.
return: Table|boolean   A Table object if found or boolean false on failure.

addIncludePath($path = null)   X-Ref
Add a filesystem path where Table should search for table class files.

param: array|string  $path  A filesystem path or array of filesystem paths to add.
return: array  An array of filesystem paths to find Table classes in.

_getAssetName()   X-Ref
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.

return: string

_getAssetTitle()   X-Ref
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.

return: string  The string to use as the title in the asset table.

_getAssetParentId(Table $table = null, $id = null)   X-Ref
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.
An extended class can define a table and ID to lookup.  If the asset does not exist it will be created.

param: Table    $table  A Table object for the asset parent.
param: integer  $id     Id to look up
return: integer

appendPrimaryKeys($query, $pk = null)   X-Ref
Method to append the primary keys for this table to a query.

param: DatabaseQuery  $query  A query object to append.
param: mixed          $pk     Optional primary key parameter.
return: void

getTableName()   X-Ref
Method to get the database table name for the class.

return: string  The name of the database table being modeled.

getKeyName($multiple = false)   X-Ref
Method to get the primary key field name for the table.

param: boolean  $multiple  True to return all primary keys (as an array) or false to return just the first one (as a string).
return: mixed  Array of primary key field names or string containing the first primary key field.

getId()   X-Ref
Returns the identity (primary key) value of this record

return: mixed

getDbo()   X-Ref
Method to get the DatabaseDriver object.

return: DatabaseDriver  The internal database driver object.

setDbo(DatabaseDriver $db)   X-Ref
Method to set the DatabaseDriver object.

param: DatabaseDriver  $db  A DatabaseDriver object to be used by the table object.
return: boolean  True on success.

setRules($input)   X-Ref
Method to set rules for the record.

param: mixed  $input  A Rules object, JSON string, or array.
return: void

getRules()   X-Ref
Method to get the rules for the record.

return: Rules object

reset()   X-Ref
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).

return: void

bind($src, $ignore = array()   X-Ref
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: array|object  $src     An associative array or object to bind to the Table instance.
param: array|string  $ignore  An optional array or space separated list of properties to ignore while binding.
return: boolean  True on success.

load($keys = null, $reset = true)   X-Ref
Method to load a row from the database by primary key and bind the fields to the Table instance properties.

param: mixed    $keys   An optional primary key value to load the row by, or an array of fields to match.
param: boolean  $reset  True to reset the default values before loading the new row.
return: boolean  True if successful. False if row not found.

check()   X-Ref
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.

return: boolean  True if the instance is sane and able to be stored in the database.

store($updateNulls = false)   X-Ref
Method to store a row in the database from the Table 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 Table instance.

param: boolean  $updateNulls  True to update fields even if they are null.
return: boolean  True on success.

save($src, $orderingFilter = '', $ignore = '')   X-Ref
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: array|object  $src             An associative array or object to bind to the Table instance.
param: string        $orderingFilter  Filter for the order updating
param: array|string  $ignore          An optional array or space separated list of properties to ignore while binding.
return: boolean  True on success.

delete($pk = null)   X-Ref
Method to delete a row from the database table by primary key value.

param: mixed  $pk  An optional primary key value to delete.  If not set the instance property value is used.
return: boolean  True on success.

checkOut($userId, $pk = null)   X-Ref
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: integer  $userId  The Id of the user checking out the row.
param: mixed    $pk      An optional primary key value to check out.  If not set the instance property value is used.
return: boolean  True on success.

checkIn($pk = null)   X-Ref
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: mixed  $pk  An optional primary key value to check out.  If not set the instance property value is used.
return: boolean  True on success.

hasPrimaryKey()   X-Ref
Validate that the primary key has been set.

return: boolean  True if the primary key(s) have been set.

hit($pk = null)   X-Ref
Method to increment the hits for a row if the necessary property/field exists.

param: mixed  $pk  An optional primary key value to increment. If not set the instance property value is used.
return: boolean  True on success.

isCheckedOut($with = 0, $against = null)   X-Ref
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: integer  $with     The user ID to perform the match with, if an item is checked out by this user the function will return false.
param: integer  $against  The user ID to perform the match against when the function is used as a static function.
return: boolean  True if checked out.

getNextOrder($where = '')   X-Ref
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: string  $where  WHERE clause to use for selecting the MAX(ordering) for the table.
return: integer  The next ordering value.

getPrimaryKey(array $keys = array()   X-Ref
Get the primary key values for this table using passed in values as a default.

param: array  $keys  Optional primary key values to use.
return: array  An array of primary key names and values.

reorder($where = '')   X-Ref
Method to compact the ordering values of rows in a group of rows defined by an SQL WHERE clause.

param: string  $where  WHERE clause to use for limiting the selection of rows to compact the ordering values.
return: mixed  Boolean  True on success.

move($delta, $where = '')   X-Ref
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: integer  $delta  The direction and magnitude to move the row in the ordering sequence.
param: string   $where  WHERE clause to use for limiting the selection of rows to compact the ordering values.
return: boolean  True on success.

publish($pks = null, $state = 1, $userId = 0)   X-Ref
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: mixed    $pks     An optional array of primary key values to update. If not set the instance property value is used.
param: integer  $state   The publishing state. eg. [0 = unpublished, 1 = published]
param: integer  $userId  The user ID of the user performing the operation.
return: boolean  True on success; false if $pks is empty.

_lock()   X-Ref
Method to lock the database table for writing.

return: boolean  True on success.

getColumnAlias($column)   X-Ref
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 \Joomla functions.

param: string  $column  Name of the "special" column (ie ordering, hits)
return: string  The string that identify the special

setColumnAlias($column, $columnAlias)   X-Ref
Method to register a column alias for a "special" column.

param: string  $column       The "special" column (ie ordering)
param: string  $columnAlias  The real column name (ie foo_ordering)
return: void

_unlock()   X-Ref
Method to unlock the database table for writing.

return: boolean  True on success.

hasField($key)   X-Ref
Check if the record has a property (applying a column alias if it exists)

param: string  $key  key to be checked
return: boolean



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer