Abstract Class Zend_Db_Table_Abstract

Description

Class for SQL table interface.

  • abstract:
  • license: New BSD License
  • copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Db/Table/Abstract.php (line 36)


	
			
Direct descendents
Class Description
Abstract class Zend_Db_Table Class for SQL table interface.
Class Constant Summary
 CASCADE = 'cascade'
 COLS = 'cols'
 COLUMNS = 'columns'
 DEPENDENT_TABLES = 'dependentTables'
 METADATA = 'metadata'
 NAME = 'name'
 ON_DELETE = 'onDelete'
 ON_UPDATE = 'onUpdate'
 PRIMARY = 'primary'
 REFERENCE_MAP = 'referenceMap'
 REF_COLUMNS = 'refColumns'
 REF_TABLE_CLASS = 'refTableClass'
 RESTRICT = 'restrict'
 ROWSET_CLASS = 'rowsetClass'
 ROW_CLASS = 'rowClass'
 SCHEMA = 'schema'
 SET_NULL = 'setNull'
Variable Summary
Method Summary
 int delete (mixed $where)
 Zend_Db_Table_Rowset_Abstract fetchAll ([string|array $where = null], [string|array $order = null], [int $count = null], [int $offset = null])
 Zend_Db_Table_Row_Abstract fetchNew (array|null $defaults)
 Zend_Db_Table_Row_Abstract|null fetchRow ([string|array $where = null], [string|array $order = null])
 array getReference (string $tableClassname, [string $ruleKey = null])
 string getRowClass ()
 string getRowsetClass ()
 array info ()
 integer insert ( $data)
 void setDependentTables ( $dependentTables)
 void setReferences ( $referenceMap)
 void setRowClass (string $classname)
 void setRowsetClass (string $classname)
 Zend_Db_Table_Abstract __construct ([ $config = array()])
 int update ( $data, string $where)
 void _cascadeDelete (string $parentTableClassname,  $primaryKey)
 void _cascadeUpdate (string $parentTableClassname,  $oldPrimaryKey,  $newPrimaryKey)
 array _fetch ([string|array $where = null], [string|array $order = null], [int $count = null], [int $offset = null])
 void _setup ()
 void _setupMetadata ()
 void _setupTableName ()
Variables
static Zend_Db_Adapter_Abstract $_defaultDb (line 64)

Default Zend_Db_Adapter_Abstract object.

  • access: protected
array $_cols (line 95)

The table column names derived from Zend_Db_Adapter_Abstract::describeTable().

The key is the underscore format, and the value is the camelized format.

  • access: protected
Zend_Db_Adapter_Abstract $_db (line 71)

Zend_Db_Adapter_Abstract object.

  • access: protected
array $_dependentTables = array() (line 153)

Simple array of class names of tables that are "children" of the current table, in other words tables that contain a foreign key to this one.

Array elements are not table names; they are class names of classes that extend Zend_Db_Table_Abstract.

  • access: protected
array $_metadata = array() (line 109)

Information provided by the adapter's describeTable() method.

  • access: protected
array $_name (line 85)

The table name derived from the class name (underscore format).

  • access: protected
string $_primary = null (line 102)

The primary key column (underscore format).

  • access: protected
array $_referenceMap = array() (line 143)

Associative array map of declarative referential integrity rules.

This array has one entry per foreign key in the current table. Each key is a mnemonic name for one reference rule.

Each value is also an associative array, with the following keys:

  • columns = array of names of column(s) in the child table.
  • refTable = class name of the parent table.
  • refColumns = array of names of column(s) in the parent table, in the same order as those in the 'columns' entry.
  • onDelete = "cascade" means that a delete in the parent table also causes a delete of referencing rows in the child table.
  • onUpdate = "cascade" means that an update of primary key values in the parent table also causes an update of referencing rows in the child table.

  • access: protected
string $_rowClass = 'Zend_Db_Table_Row' (line 116)

Default classname for row

  • access: protected
string $_rowsetClass = 'Zend_Db_Table_Rowset' (line 123)

Default classname for rowset

  • access: protected
array $_schema = null (line 78)

The schema name (default null means current schema)

  • access: protected
Methods
static getDefaultAdapter (line 329)

Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.

  • access: public
static Zend_Db_Adapter_Abstract getDefaultAdapter ()
static setDefaultAdapter (line 319)

Sets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.

  • access: public
static void setDefaultAdapter (Zend_Db_Adapter_Abstract $db)
delete (line 540)

Deletes existing rows.

  • return: The number of rows deleted.
  • access: public
int delete (mixed $where)
  • mixed $where: An SQL WHERE clause.
fetchAll (line 652)

Fetches all rows.

Honors the Zend_Db_Adapter fetch mode.

  • return: The row results per the Zend_Db_Adapter fetch mode.
  • access: public
Zend_Db_Table_Rowset_Abstract fetchAll ([string|array $where = null], [string|array $order = null], [int $count = null], [int $offset = null])
  • string|array $where: OPTIONAL An SQL WHERE clause.
  • string|array $order: OPTIONAL An SQL ORDER clause.
  • int $count: OPTIONAL An SQL LIMIT count.
  • int $offset: OPTIONAL An SQL LIMIT offset.
fetchNew (line 700)

Fetches a new blank row (not from the database).

  • access: public
Zend_Db_Table_Row_Abstract fetchNew (array|null $defaults)
  • array|null $defaults: User-supplied defaults for a new row
fetchRow (line 673)

Fetches one row in an object of type Zend_Db_Table_Row_Abstract, or returns Boolean false if no row matches the specified criteria.

  • return: The row results per the Zend_Db_Adapter fetch mode, or null if no row found.
  • access: public
Zend_Db_Table_Row_Abstract|null fetchRow ([string|array $where = null], [string|array $order = null])
  • string|array $where: OPTIONAL An SQL WHERE clause.
  • string|array $order: OPTIONAL An SQL ORDER clause.
find (line 594)

Fetches rows by primary key.

The arguments specify the primary key values. If the table has a multi-column primary key, you must pass as many arguments as the count of column in the primary key.

To find multiple rows by primary key, the argument should be an array. If the table has a multi-column primary key, all arguments must be arrays with the same number of elements.

The find() method always returns a Rowset object, even if only one row was found.

  • return: Row(s) matching the criteria.
  • access: public
  • throws: Zend_Db_Table_Exception
  • mixed 0: The value(s) of the primary key.
getAdapter (line 339)

Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.

  • access: public
Zend_Db_Adapter_Abstract getAdapter ()
getDependentTables (line 308)
  • access: public
array getDependentTables ()
getReference (line 273)
  • access: public
  • throws: Zend_Db_Table_Exception
array getReference (string $tableClassname, [string $ruleKey = null])
  • string $tableClassname
  • string $ruleKey: OPTIONAL
getRowClass (line 235)
  • access: public
string getRowClass ()
getRowsetClass (line 253)
  • access: public
string getRowsetClass ()
info (line 454)

Returns table information.

  • access: public
array info ()
insert (line 475)

Inserts a new row.

  • return: The last insert ID.
  • access: public
integer insert ( $data)
  • array $data: Column-value pairs.
setDependentTables (line 300)
  • access: public
void setDependentTables ( $dependentTables)
  • array $dependentTables
setReferences (line 262)
  • access: public
void setReferences ( $referenceMap)
  • array $referenceMap
setRowClass (line 227)
  • access: public
  • throws: Zend_Exception If $classname cannot be loaded.
void setRowClass (string $classname)
  • string $classname
setRowsetClass (line 245)
  • access: public
  • throws: Zend_Exception If $classname cannot be loaded.
void setRowsetClass (string $classname)
  • string $classname
Constructor __construct (line 173)

Constructor.

Supported params for $config are:

  • db = user-supplied instance of database connector, or key name of registry instance.
  • name = table name.
  • primary = string or array of primary key(s).
  • rowclass = row class name.
  • rowsetClass = rowset class name.
  • referenceMap = array structure to declare relationship to parent tables.
  • dependentTables = array of child tables.

  • access: public
  • throws: Zend_Db_Table_Exception
  • throws: Zend_Exception If Row or Rowset classes specified cannot be loaded.
Zend_Db_Table_Abstract __construct ([ $config = array()])
  • array $config: Array of user-specified config options.
update (line 494)

Updates existing rows.

  • return: The number of rows updated.
  • access: public
int update ( $data, string $where)
  • array $data: Column-value pairs.
  • string $where: An SQL WHERE clause.
_cascadeDelete (line 551)

Called by parent table's class during delete() method.

  • access: public
void _cascadeDelete (string $parentTableClassname,  $primaryKey)
  • string $parentTableClassname
  • array $primaryKey
_cascadeUpdate (line 506)

Called by a row object for the parent table's class during save() method.

  • access: public
void _cascadeUpdate (string $parentTableClassname,  $oldPrimaryKey,  $newPrimaryKey)
  • string $parentTableClassname
  • array $oldPrimaryKey
  • array $newPrimaryKey
_fetch (line 724)

Support method for fetching rows.

  • return: The row results, in FETCH_ASSOC mode.
  • access: protected
array _fetch ([string|array $where = null], [string|array $order = null], [int $count = null], [int $offset = null])
  • string|array $where: OPTIONAL An SQL WHERE clause.
  • string|array $order: OPTIONAL An SQL ORDER clause.
  • int $count: OPTIONAL An SQL LIMIT count.
  • int $offset: OPTIONAL An SQL LIMIT offset.
_setup (line 352)

Turnkey for initialization of a table object.

Calls other protected methods for individual tasks, to make it easier for a subclass to override part of the setup logic.

  • access: protected
  • throws: Zend_Db_Table_Exception
void _setup ()
_setupDatabaseAdapter (line 366)

Initialize database adapter.

  • access: protected
  • throws: Zend_Db_Table_Exception
void _setupDatabaseAdapter ()
_setupMetadata (line 401)

Initialize metadata.

Call describeTable() to discover metadata information.

  • access: protected
  • throws: Zend_Db_Table_Exception
void _setupMetadata ()
_setupPrimaryKey (line 429)

Initialize primary key from metadata.

If $_primary is not defined, discover primary keys from the information returned by describeTable().

  • access: protected
  • throws: Zend_Db_Table_Exception
void _setupPrimaryKey ()
_setupTableName (line 387)

Initialize table name.

If the table name is not set in the class definition, use the class name itself as the table name.

  • access: protected
  • throws: Zend_Db_Table_Exception
void _setupTableName ()
Class Constants
CASCADE = 'cascade' (line 55)
COLS = 'cols' (line 42)
COLUMNS = 'columns' (line 49)
DEPENDENT_TABLES = 'dependentTables' (line 47)
METADATA = 'metadata' (line 43)
NAME = 'name' (line 40)
ON_DELETE = 'onDelete' (line 52)
ON_UPDATE = 'onUpdate' (line 53)
PRIMARY = 'primary' (line 41)
REFERENCE_MAP = 'referenceMap' (line 46)
REF_COLUMNS = 'refColumns' (line 51)
REF_TABLE_CLASS = 'refTableClass' (line 50)
RESTRICT = 'restrict' (line 56)
ROWSET_CLASS = 'rowsetClass' (line 45)
ROW_CLASS = 'rowClass' (line 44)
SCHEMA = 'schema' (line 39)
SET_NULL = 'setNull' (line 57)

Documentation generated on Fri, 06 Apr 2007 18:14:58 -0700 by phpDocumentor 1.3.1