Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
    • REST
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Db
      • Adapter
      • Expr
      • Profiler
      • Select
      • Statement
      • Table
    • Loader
      • Autoloader
      • PluginLoader
    • Registry

Classes

  • Zend_Db_Table
  • Zend_Db_Table_Abstract
  • Zend_Db_Table_Definition
  • Zend_Db_Table_Row
  • Zend_Db_Table_Row_Abstract
  • Zend_Db_Table_Rowset
  • Zend_Db_Table_Rowset_Abstract
  • Zend_Db_Table_Select

Exceptions

  • Zend_Db_Table_Exception
  • Zend_Db_Table_Row_Exception
  • Zend_Db_Table_Rowset_Exception
  • Zend_Db_Table_Select_Exception
  • Overview
  • Package
  • Class
  • Tree

Class Zend_Db_Table_Abstract

Class for SQL table interface.

Direct known subclasses

Zend_Db_Table
Abstract
Package: Zend\Db\Table
Category: Zend
Copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
License: New BSD License
Located at Zend/Db/Table/Abstract.php
Methods summary
public
# __construct( mixed $config = array() )

Constructor.

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.
  • metadataCache = cache for information from adapter describeTable().

Parameters

$config
mixed
Array of user-specified config options, or just the Db Adapter.
public Zend_Db_Table_Abstract
# setOptions( array $options )

setOptions()

setOptions()

Parameters

$options
array

Returns

Zend_Db_Table_Abstract
public Zend_Db_Table_Abstract
# setDefinition( Zend_Db_Table_Definition $definition )

setDefinition()

setDefinition()

Parameters

$definition
Zend_Db_Table_Definition

Returns

Zend_Db_Table_Abstract
public Zend_Db_Table_Definition|null
# getDefinition( )

getDefinition()

getDefinition()

Returns

Zend_Db_Table_Definition|null
public Zend_Db_Table_Abstract
# setDefinitionConfigName( string $definitionConfigName )

setDefinitionConfigName()

setDefinitionConfigName()

Parameters

$definitionConfigName
string
$definition

Returns

Zend_Db_Table_Abstract
public string
# getDefinitionConfigName( )

getDefinitionConfigName()

getDefinitionConfigName()

Returns

string
public Zend_Db_Table_Abstract
# setRowClass( string $classname )

Parameters

$classname
string

Returns

Zend_Db_Table_Abstract
Provides a fluent interface
public string
# getRowClass( )

Returns

string
public Zend_Db_Table_Abstract
# setRowsetClass( string $classname )

Parameters

$classname
string

Returns

Zend_Db_Table_Abstract
Provides a fluent interface
public string
# getRowsetClass( )

Returns

string
public Zend_Db_Table_Abstract
# addReference( string $ruleKey, string|array $columns, string $refTableClass, string|array $refColumns, string $onDelete = null, string $onUpdate = null )

Add a reference to the reference map

Add a reference to the reference map

Parameters

$ruleKey
string
$columns
string|array
$refTableClass
string
$refColumns
string|array
$onDelete
string
$onUpdate
string

Returns

Zend_Db_Table_Abstract
public Zend_Db_Table_Abstract
# setReferences( array $referenceMap )

Parameters

$referenceMap
array

Returns

Zend_Db_Table_Abstract
Provides a fluent interface
public array
# getReference( string $tableClassname, string $ruleKey = null )

Parameters

$tableClassname
string
$ruleKey
string
OPTIONAL

Returns

array

Throws

Zend_Db_Table_Exception
public Zend_Db_Table_Abstract
# setDependentTables( array $dependentTables )

Parameters

$dependentTables
array

Returns

Zend_Db_Table_Abstract
Provides a fluent interface
public array
# getDependentTables( )

Returns

array
public Zend_Db_Table_Abstract
# setDefaultSource( string $defaultSource = Zend_Db_Table_Abstract::DEFAULT_NONE )

set the defaultSource property - this tells the table class where to find default values

set the defaultSource property - this tells the table class where to find default values

Parameters

$defaultSource
string

Returns

Zend_Db_Table_Abstract
public unknown
# getDefaultSource( )

returns the default source flag that determines where defaultSources come from

returns the default source flag that determines where defaultSources come from

Returns

unknown
public Zend_Db_Table_Abstract
# setDefaultValues( array $defaultValues )

set the default values for the table class

set the default values for the table class

Parameters

$defaultValues
array

Returns

Zend_Db_Table_Abstract
public
# getDefaultValues( )
public static
# setDefaultAdapter( mixed $db = null )

Sets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.

Sets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.

Parameters

$db
mixed
Either an Adapter object, or a string naming a Registry key
public static Zend_Db_Adapter_Abstract
# getDefaultAdapter( )

Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.

Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.

Returns

Zend_Db_Adapter_Abstract
or null
protected Zend_Db_Table_Abstract
# _setAdapter( mixed $db )

Parameters

$db
mixed
Either an Adapter object, or a string naming a Registry key

Returns

Zend_Db_Table_Abstract
Provides a fluent interface
public Zend_Db_Adapter_Abstract
# getAdapter( )

Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.

Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.

Returns

Zend_Db_Adapter_Abstract
protected static Zend_Db_Adapter_Abstract
# _setupAdapter( mixed $db )

Parameters

$db
mixed
Either an Adapter object, or a string naming a Registry key

Returns

Zend_Db_Adapter_Abstract

Throws

Zend_Db_Table_Exception
public static
# setDefaultMetadataCache( mixed $metadataCache = null )

Sets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

Sets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

If $defaultMetadataCache is null, then no metadata cache is used by default.

Parameters

$metadataCache
mixed
Either a Cache object, or a string naming a Registry key
public static Zend_Cache_Core
# getDefaultMetadataCache( )

Gets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

Gets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

Returns

Zend_Cache_Core
or null
protected Zend_Db_Table_Abstract
# _setMetadataCache( mixed $metadataCache )

Sets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

Sets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

If $metadataCache is null, then no metadata cache is used. Since there is no opportunity to reload metadata after instantiation, this method need not be public, particularly because that it would have no effect results in unnecessary API complexity. To configure the metadata cache, use the metadataCache configuration option for the class constructor upon instantiation.

Parameters

$metadataCache
mixed
Either a Cache object, or a string naming a Registry key

Returns

Zend_Db_Table_Abstract
Provides a fluent interface
public Zend_Cache_Core
# getMetadataCache( )

Gets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

Gets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().

Returns

Zend_Cache_Core
or null
public Zend_Db_Table_Abstract
# setMetadataCacheInClass( boolean $flag )

Indicate whether metadata should be cached in the class for the duration of the instance

Indicate whether metadata should be cached in the class for the duration of the instance

Parameters

$flag
boolean

Returns

Zend_Db_Table_Abstract
public boolean
# metadataCacheInClass( )

Retrieve flag indicating if metadata should be cached for duration of instance

Retrieve flag indicating if metadata should be cached for duration of instance

Returns

boolean
protected static Zend_Cache_Core
# _setupMetadataCache( mixed $metadataCache )

Parameters

$metadataCache
mixed
Either a Cache object, or a string naming a Registry key

Returns

Zend_Cache_Core

Throws

Zend_Db_Table_Exception
protected Zend_Db_Table_Adapter_Abstract
# _setSequence( mixed $sequence )

Sets the sequence member, which defines the behavior for generating primary key values in new rows.

  • If this is a string, then the string names the sequence object.
  • If this is boolean true, then the key uses an auto-incrementing

    or identity mechanism.

  • If this is boolean false, then the key is user-defined.

    Use this for natural keys, for example.

Sets the sequence member, which defines the behavior for generating primary key values in new rows.

  • If this is a string, then the string names the sequence object.
  • If this is boolean true, then the key uses an auto-incrementing or identity mechanism.
  • If this is boolean false, then the key is user-defined. Use this for natural keys, for example.

Parameters

$sequence
mixed

Returns

Zend_Db_Table_Adapter_Abstract
Provides a fluent interface
protected
# _setup( )

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.

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.

protected
# _setupDatabaseAdapter( )

Initialize database adapter.

Initialize database adapter.

protected
# _setupTableName( )

Initialize table and schema names.

Initialize table and schema names.

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

A schema name provided with the table name (e.g., "schema.table") overrides any existing value for $this->_schema.

protected boolean
# _setupMetadata( )

Initializes metadata.

Initializes metadata.

If metadata cannot be loaded from cache, adapter's describeTable() method is called to discover metadata information. Returns true if and only if the metadata are loaded from cache.

Returns

boolean

Throws

Zend_Db_Table_Exception
protected array
# _getCols( )

Retrieve table columns

Retrieve table columns

Returns

array
protected
# _setupPrimaryKey( )

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

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

Throws

Zend_Db_Table_Exception
protected array
# _getReferenceMapNormalized( )

Returns a normalized version of the reference map

Returns a normalized version of the reference map

Returns

array
public
# init( )

Initialize object

Initialize object

Called from Zend_Db_Table_Abstract::__construct() as final step of object instantiation.

public mixed
# info( string $key = null )

Returns table information.

Returns table information.

You can elect to return only a part of this information by supplying its key name, otherwise all information is returned as an array.

Parameters

$key
string
The specific info part to return OPTIONAL

Returns

mixed
public Zend_Db_Table_Select
# select( boolean $withFromPart = Zend_Db_Table_Abstract::SELECT_WITHOUT_FROM_PART )

Returns an instance of a Zend_Db_Table_Select object.

Returns an instance of a Zend_Db_Table_Select object.

Parameters

$withFromPart
boolean
Whether or not to include the from part of the select based on the table

Returns

Zend_Db_Table_Select
public mixed
# insert( array $data )

Inserts a new row.

Inserts a new row.

Parameters

$data
array
Column-value pairs.

Returns

mixed
The primary key of the row inserted.
public boolean
# isIdentity( string $column )

Check if the provided column is an identity of the table

Check if the provided column is an identity of the table

Parameters

$column
string

Returns

boolean

Throws

Zend_Db_Table_Exception
public integer
# update( array $data, array|string $where )

Updates existing rows.

Updates existing rows.

Parameters

$data
array
Column-value pairs.
$where
array|string
An SQL WHERE clause, or an array of SQL WHERE clauses.

Returns

integer
The number of rows updated.
public integer
# _cascadeUpdate( string $parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey )

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

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

Parameters

$parentTableClassname
string
$oldPrimaryKey
array
$newPrimaryKey
array

Returns

integer
public integer
# delete( array|string $where )

Deletes existing rows.

Deletes existing rows.

Parameters

$where
array|string
SQL WHERE clause(s).

Returns

integer
The number of rows deleted.
public integer
# _cascadeDelete( string $parentTableClassname, array $primaryKey )

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

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

Parameters

$parentTableClassname
string
$primaryKey
array

Returns

integer
Number of affected rows
public Zend_Db_Table_Rowset_Abstract
# find( )

Fetches rows by primary key. The argument specifies one or more primary key value(s). To find multiple rows by primary key, the argument must be an array.

Fetches rows by primary key. The argument specifies one or more primary key value(s). To find multiple rows by primary key, the argument must be an array.

This method accepts a variable number of arguments. If the table has a multi-column primary key, the number of arguments must be the same as the number of columns in the primary key. To find multiple rows in a table with a multi-column primary key, each argument must be an array with the same number of elements.

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

Returns

Zend_Db_Table_Rowset_Abstract
Row(s) matching the criteria.

Throws

Zend_Db_Table_Exception
public Zend_Db_Table_Rowset_Abstract
# fetchAll( string|array|Zend_Db_Table_Select $where = null, string|array $order = null, integer $count = null, integer $offset = null )

Fetches all rows.

Fetches all rows.

Honors the Zend_Db_Adapter fetch mode.

Parameters

$where
string|array|Zend_Db_Table_Select
OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object.
$order
string|array
OPTIONAL An SQL ORDER clause.
$count
integer
OPTIONAL An SQL LIMIT count.
$offset
integer
OPTIONAL An SQL LIMIT offset.

Returns

Zend_Db_Table_Rowset_Abstract
The row results per the Zend_Db_Adapter fetch mode.
public Zend_Db_Table_Row_Abstract|null
# fetchRow( string|array|Zend_Db_Table_Select $where = null, string|array $order = null )

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

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

Parameters

$where
string|array|Zend_Db_Table_Select
OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object.
$order
string|array
OPTIONAL An SQL ORDER clause.

Returns

Zend_Db_Table_Row_Abstract|null
The row results per the Zend_Db_Adapter fetch mode, or null if no row found.
public Zend_Db_Table_Row_Abstract
# createRow( array $data = array(), string $defaultSource = null )

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

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

Parameters

$data
array
OPTIONAL data to populate in the new row.
$defaultSource
string
OPTIONAL flag to force default values into new row

Returns

Zend_Db_Table_Row_Abstract
protected Zend_Db_Table_Select
# _where( Zend_Db_Table_Select $select, $where )

Generate WHERE clause from user-supplied string or array

Generate WHERE clause from user-supplied string or array

Parameters

$select
string|array
$where OPTIONAL An SQL WHERE clause.
$where

Returns

Zend_Db_Table_Select
protected Zend_Db_Table_Select
# _order( Zend_Db_Table_Select $select, $order )

Generate ORDER clause from user-supplied string or array

Generate ORDER clause from user-supplied string or array

Parameters

$select
string|array
$order OPTIONAL An SQL ORDER clause.
$order

Returns

Zend_Db_Table_Select
protected array
# _fetch( Zend_Db_Table_Select $select )

Support method for fetching rows.

Support method for fetching rows.

Parameters

$select
Zend_Db_Table_Select
query options.

Returns

array
An array containing the row results in FETCH_ASSOC mode.
Constants summary
string ADAPTER 'db'
#
string DEFINITION 'definition'
#
string DEFINITION_CONFIG_NAME 'definitionConfigName'
#
string SCHEMA 'schema'
#
string NAME 'name'
#
string PRIMARY 'primary'
#
string COLS 'cols'
#
string METADATA 'metadata'
#
string METADATA_CACHE 'metadataCache'
#
string METADATA_CACHE_IN_CLASS 'metadataCacheInClass'
#
string ROW_CLASS 'rowClass'
#
string ROWSET_CLASS 'rowsetClass'
#
string REFERENCE_MAP 'referenceMap'
#
string DEPENDENT_TABLES 'dependentTables'
#
string SEQUENCE 'sequence'
#
string COLUMNS 'columns'
#
string REF_TABLE_CLASS 'refTableClass'
#
string REF_COLUMNS 'refColumns'
#
string ON_DELETE 'onDelete'
#
string ON_UPDATE 'onUpdate'
#
string CASCADE 'cascade'
#
string RESTRICT 'restrict'
#
string SET_NULL 'setNull'
#
string DEFAULT_NONE 'defaultNone'
#
string DEFAULT_CLASS 'defaultClass'
#
string DEFAULT_DB 'defaultDb'
#
boolean SELECT_WITH_FROM_PART true
#
boolean SELECT_WITHOUT_FROM_PART false
#
Properties summary
protected static Zend_Db_Adapter_Abstract $_defaultDb
#

Default Zend_Db_Adapter_Abstract object.

Default Zend_Db_Adapter_Abstract object.

protected unknown_type $_definition null
#

Optional Zend_Db_Table_Definition object

Optional Zend_Db_Table_Definition object

protected string $_definitionConfigName null
#

Optional definition config name used in concrete implementation

Optional definition config name used in concrete implementation

protected static Zend_Cache_Core $_defaultMetadataCache null
#

Default cache for information provided by the adapter's describeTable() method.

Default cache for information provided by the adapter's describeTable() method.

protected Zend_Db_Adapter_Abstract $_db
#

Zend_Db_Adapter_Abstract object.

Zend_Db_Adapter_Abstract object.

protected array $_schema null
#

The schema name (default null means current schema)

The schema name (default null means current schema)

protected string $_name null
#

The table name.

The table name.

protected array $_cols
#

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

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

protected mixed $_primary null
#

The primary key column or columns. A compound key should be declared as an array. You may declare a single-column primary key as a string.

The primary key column or columns. A compound key should be declared as an array. You may declare a single-column primary key as a string.

protected integer $_identity 1
#

If your primary key is a compound key, and one of the columns uses an auto-increment or sequence-generated value, set _identity to the ordinal index in the $_primary array for that column. Note this index is the position of the column in the primary key, not the position of the column in the table. The primary key array is 1-based.

If your primary key is a compound key, and one of the columns uses an auto-increment or sequence-generated value, set _identity to the ordinal index in the $_primary array for that column. Note this index is the position of the column in the primary key, not the position of the column in the table. The primary key array is 1-based.

protected mixed $_sequence true
#

Define the logic for new values in the primary key. May be a string, boolean true, or boolean false.

Define the logic for new values in the primary key. May be a string, boolean true, or boolean false.

protected array $_metadata array()
#

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

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

protected Zend_Cache_Core $_metadataCache null
#

Cache for information provided by the adapter's describeTable() method.

Cache for information provided by the adapter's describeTable() method.

protected boolean $_metadataCacheInClass true
#

Flag: whether or not to cache metadata in the class

Flag: whether or not to cache metadata in the class

protected string $_rowClass 'Zend_Db_Table_Row'
#

Classname for row

Classname for row

protected string $_rowsetClass 'Zend_Db_Table_Rowset'
#

Classname for rowset

Classname for rowset

protected array $_referenceMap array()
#

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.

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.
  • refTableClass = 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.
protected array $_dependentTables array()
#

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.

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.

protected string $_defaultSource Zend_Db_Table_Abstract::DEFAULT_NONE
#
protected array $_defaultValues array()
#
Pry Framework API documentation generated by ApiGen 2.6.1