Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Class for SQL table interface.
ADAPTER = 'db'
Details DEFINITION = 'definition'
Details DEFINITION_CONFIG_NAME = 'definitionConfigName'
Details SCHEMA = 'schema'
Details NAME = 'name'
Details PRIMARY = 'primary'
Details COLS = 'cols'
Details METADATA = 'metadata'
Details METADATA_CACHE = 'metadataCache'
Details METADATA_CACHE_IN_CLASS = 'metadataCacheInClass'
Details ROW_CLASS = 'rowClass'
Details ROWSET_CLASS = 'rowsetClass'
Details REFERENCE_MAP = 'referenceMap'
Details DEPENDENT_TABLES = 'dependentTables'
Details SEQUENCE = 'sequence'
Details COLUMNS = 'columns'
Details REF_TABLE_CLASS = 'refTableClass'
Details REF_COLUMNS = 'refColumns'
Details ON_DELETE = 'onDelete'
Details ON_UPDATE = 'onUpdate'
Details CASCADE = 'cascade'
Details RESTRICT = 'restrict'
Details SET_NULL = 'setNull'
Details DEFAULT_NONE = 'defaultNone'
Details DEFAULT_CLASS = 'defaultClass'
Details DEFAULT_DB = 'defaultDb'
Details SELECT_WITH_FROM_PART = 'true'
Details SELECT_WITHOUT_FROM_PART = 'false'
Detailsarray $_cols = ''The table column names derived from Zend_Db_Adapter_Abstract::describeTable().
DetailsZend_Db_Adapter_Abstract $_db = ''Zend_Db_Adapter_Abstract object.
DetailsZend_Db_Adapter_Abstract $_defaultDb = ''Default Zend_Db_Adapter_Abstract object.
DetailsZend_Cache_Core $_defaultMetadataCache = 'null'Default cache for information provided by the adapter's describeTable() method.
Details $_defaultSource = 'self'
Details $_defaultValues = 'array'
Detailsunknown_type $_definition = 'null'Optional Zend_Db_Table_Definition object
Detailsstring $_definitionConfigName = 'null'Optional definition config name used in concrete implementation
Detailsarray $_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.
Detailsinteger $_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.
Detailsarray $_metadata = 'array'Information provided by the adapter's describeTable() method.
DetailsZend_Cache_Core $_metadataCache = 'null'Cache for information provided by the adapter's describeTable() method.
Detailsbool $_metadataCacheInClass = 'true'Flag: whether or not to cache metadata in the class
Detailsstring $_name = 'null'The table name.
Detailsmixed $_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.
Detailsarray $_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.
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.
Detailsstring $_rowClass = 'Zend_Db_Table_Row'Classname for row
Detailsstring $_rowsetClass = 'Zend_Db_Table_Rowset'Classname for rowset
Detailsarray $_schema = 'null'The schema name (default null means current schema)
Detailsmixed $_sequence = 'true'Define the logic for new values in the primary key.
May be a string, boolean true, or boolean false.
Details__construct(
mixed $config
=
array
)
:
voidConstructor.
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().
Details_cascadeDelete(
string $parentTableClassname, array $primaryKey
)
:
intCalled by parent table's class during delete() method.
Details_cascadeUpdate(
string $parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey
)
:
intCalled by a row object for the parent table's class during save() method.
Details_fetch(
Zend_Db_Table_Select $select
)
:
arraySupport method for fetching rows.
Details_getCols(
)
:
arrayRetrieve table columns
Details_getReferenceMapNormalized(
)
:
arrayReturns a normalized version of the reference map
Details_order(
$select, string|array $order
)
:
Zend_Db_Table_SelectGenerate ORDER clause from user-supplied string or array
Details_setAdapter(
mixed $db
)
:
Zend_Db_Table_Abstract
Details_setMetadataCache(
mixed $metadataCache
)
:
Zend_Db_Table_AbstractSets 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.
Details_setSequence(
mixed $sequence
)
:
Zend_Db_Table_Adapter_AbstractSets the sequence member, which defines the behavior for generating primary key values in new rows.
Details_setup(
)
:
voidTurnkey 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.
Details_setupAdapter(
mixed $db
)
:
Zend_Db_Adapter_Abstract
Details_setupDatabaseAdapter(
)
:
voidInitialize database adapter.
Details_setupMetadata(
)
:
booleanInitializes 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.
Details_setupMetadataCache(
mixed $metadataCache
)
:
Zend_Cache_Core
Details_setupPrimaryKey(
)
:
voidInitialize primary key from metadata.
If $_primary is not defined, discover primary keys from the information returned by describeTable().
Details_setupTableName(
)
:
voidInitialize 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.
Details_where(
$select, string|array $where
)
:
Zend_Db_Table_SelectGenerate WHERE clause from user-supplied string or array
DetailsaddReference(
string $ruleKey, string|array $columns, string $refTableClass, string|array $refColumns, string $onDelete
=
null, string $onUpdate
=
null
)
:
Zend_Db_Table_AbstractAdd a reference to the reference map
DetailscreateRow(
array $data
=
array, string $defaultSource
=
null
)
:
Zend_Db_Table_Row_AbstractFetches a new blank row (not from the database).
Detailsdelete(
array|string $where
)
:
intDeletes existing rows.
DetailsfetchAll(
string|array|Zend_Db_Table_Select $where
=
null, string|array $order
=
null, int $count
=
null, int $offset
=
null
)
:
Zend_Db_Table_Rowset_AbstractFetches all rows.
Honors the Zend_Db_Adapter fetch mode.
DetailsfetchNew(
)
:
Zend_Db_Table_Row_AbstractFetches a new blank row (not from the database).
DetailsfetchRow(
string|array|Zend_Db_Table_Select $where
=
null, string|array $order
=
null
)
:
Zend_Db_Table_Row_Abstract|nullFetches one row in an object of type Zend_Db_Table_Row_Abstract, or returns null if no row matches the specified criteria.
Detailsfind(
)
:
Zend_Db_Table_Rowset_AbstractFetches 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.
DetailsgetAdapter(
)
:
Zend_Db_Adapter_AbstractGets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.
DetailsgetDefaultAdapter(
)
:
Zend_Db_Adapter_AbstractGets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
DetailsgetDefaultMetadataCache(
)
:
Zend_Cache_CoreGets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
DetailsgetDefaultSource(
)
:
unknownreturns the default source flag that determines where defaultSources come from
DetailsgetDefaultValues(
)
:
DetailsgetDefinition(
)
:
Zend_Db_Table_Definition|nullgetDefinition()
DetailsgetDefinitionConfigName(
)
:
stringgetDefinitionConfigName()
DetailsgetDependentTables(
)
:
array
DetailsgetMetadataCache(
)
:
Zend_Cache_CoreGets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
DetailsgetReference(
string $tableClassname, string $ruleKey
=
null
)
:
array
DetailsgetRowClass(
)
:
string
DetailsgetRowsetClass(
)
:
string
Detailsinfo(
$key $key
=
null
)
:
mixedReturns 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.
Detailsinit(
)
:
voidInitialize object
Called from {@link __construct()} as final step of object instantiation.
Detailsinsert(
array $data
)
:
mixedInserts a new row.
DetailsisIdentity(
string $column
)
:
booleanCheck if the provided column is an identity of the table
DetailsmetadataCacheInClass(
)
:
boolRetrieve flag indicating if metadata should be cached for duration of instance
Detailsselect(
bool $withFromPart
=
self
)
:
Zend_Db_Table_SelectReturns an instance of a Zend_Db_Table_Select object.
DetailssetDefaultAdapter(
mixed $db
=
null
)
:
voidSets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
DetailssetDefaultMetadataCache(
mixed $metadataCache
=
null
)
:
voidSets 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.
DetailssetDefaultSource(
string $defaultSource
=
self
)
:
Zend_Db_Table_Abstractset the defaultSource property - this tells the table class where to find default values
DetailssetDefaultValues(
array $defaultValues
)
:
Zend_Db_Table_Abstractset the default values for the table class
DetailssetDefinition(
Zend_Db_Table_Definition $definition
)
:
Zend_Db_Table_AbstractsetDefinition()
DetailssetDefinitionConfigName(
$definitionConfigName
)
:
Zend_Db_Table_AbstractsetDefinitionConfigName()
DetailssetDependentTables(
array $dependentTables
)
:
Zend_Db_Table_Abstract
DetailssetMetadataCacheInClass(
bool $flag
)
:
Zend_Db_Table_AbstractIndicate whether metadata should be cached in the class for the duration of the instance
DetailssetOptions(
array $options
)
:
Zend_Db_Table_AbstractsetOptions()
DetailssetReferences(
array $referenceMap
)
:
Zend_Db_Table_Abstract
DetailssetRowClass(
string $classname
)
:
Zend_Db_Table_Abstract
DetailssetRowsetClass(
string $classname
)
:
Zend_Db_Table_Abstract
Detailsupdate(
array $data, array|string $where
)
:
intUpdates existing rows.
Details