Public Member Functions | |
__construct ($config=array()) | |
setOptions (Array $options) | |
setDefinition (Zend_Db_Table_Definition $definition) | |
getDefinition () | |
setDefinitionConfigName ($definitionConfigName) | |
getDefinitionConfigName () | |
setRowClass ($classname) | |
getRowClass () | |
setRowsetClass ($classname) | |
getRowsetClass () | |
addReference ($ruleKey, $columns, $refTableClass, $refColumns, $onDelete=null, $onUpdate=null) | |
setReferences (array $referenceMap) | |
getReference ($tableClassname, $ruleKey=null) | |
setDependentTables (array $dependentTables) | |
getDependentTables () | |
setDefaultSource ($defaultSource=self::DEFAULT_NONE) | |
getDefaultSource () | |
setDefaultValues (Array $defaultValues) | |
getDefaultValues () | |
getAdapter () | |
getMetadataCache () | |
setMetadataCacheInClass ($flag) | |
metadataCacheInClass () | |
init () | |
info ($key=null) | |
select ($withFromPart=self::SELECT_WITHOUT_FROM_PART) | |
insert (array $data) | |
isIdentity ($column) | |
update (array $data, $where) | |
_cascadeUpdate ($parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey) | |
delete ($where) | |
_cascadeDelete ($parentTableClassname, array $primaryKey) | |
find () | |
fetchAll ($where=null, $order=null, $count=null, $offset=null) | |
fetchRow ($where=null, $order=null) | |
fetchNew () | |
createRow (array $data=array(), $defaultSource=null) | |
Static Public Member Functions | |
static | setDefaultAdapter ($db=null) |
static | getDefaultAdapter () |
static | setDefaultMetadataCache ($metadataCache=null) |
static | getDefaultMetadataCache () |
Data Fields | |
const | ADAPTER = 'db' |
const | DEFINITION = 'definition' |
const | DEFINITION_CONFIG_NAME = 'definitionConfigName' |
const | SCHEMA = 'schema' |
const | NAME = 'name' |
const | PRIMARY = 'primary' |
const | COLS = 'cols' |
const | METADATA = 'metadata' |
const | METADATA_CACHE = 'metadataCache' |
const | METADATA_CACHE_IN_CLASS = 'metadataCacheInClass' |
const | ROW_CLASS = 'rowClass' |
const | ROWSET_CLASS = 'rowsetClass' |
const | REFERENCE_MAP = 'referenceMap' |
const | DEPENDENT_TABLES = 'dependentTables' |
const | SEQUENCE = 'sequence' |
const | COLUMNS = 'columns' |
const | REF_TABLE_CLASS = 'refTableClass' |
const | REF_COLUMNS = 'refColumns' |
const | ON_DELETE = 'onDelete' |
const | ON_UPDATE = 'onUpdate' |
const | CASCADE = 'cascade' |
const | RESTRICT = 'restrict' |
const | SET_NULL = 'setNull' |
const | DEFAULT_NONE = 'defaultNone' |
const | DEFAULT_CLASS = 'defaultClass' |
const | DEFAULT_DB = 'defaultDb' |
const | SELECT_WITH_FROM_PART = true |
const | SELECT_WITHOUT_FROM_PART = false |
Protected Member Functions | |
_setAdapter ($db) | |
_setMetadataCache ($metadataCache) | |
_setSequence ($sequence) | |
_setup () | |
_setupDatabaseAdapter () | |
_setupTableName () | |
_setupMetadata () | |
_getCols () | |
_setupPrimaryKey () | |
_getReferenceMapNormalized () | |
_where (Zend_Db_Table_Select $select, $where) | |
_order (Zend_Db_Table_Select $select, $order) | |
_fetch (Zend_Db_Table_Select $select) | |
Static Protected Member Functions | |
static | _setupAdapter ($db) |
static | _setupMetadataCache ($metadataCache) |
Protected Attributes | |
$_definition = null | |
$_definitionConfigName = null | |
$_db | |
$_schema = null | |
$_name = null | |
$_cols | |
$_primary = null | |
$_identity = 1 | |
$_sequence = true | |
$_metadata = array() | |
$_metadataCache = null | |
$_metadataCacheInClass = true | |
$_rowClass = 'Zend_Db_Table_Row' | |
$_rowsetClass = 'Zend_Db_Table_Rowset' | |
$_referenceMap = array() | |
$_dependentTables = array() | |
$_defaultSource = self::DEFAULT_NONE | |
$_defaultValues = array() | |
Static Protected Attributes | |
static | $_defaultDb |
static | $_defaultMetadataCache = null |
Definition at line 47 of file Abstract.php.
__construct | ( | $ | config = array() ) |
Constructor.
Supported params for $config are:
mixed | $config | Array of user-specified config options, or just the Db Adapter. |
Allow a scalar argument to be the Adapter object or Registry key.
Definition at line 255 of file Abstract.php.
_cascadeDelete | ( | $ | parentTableClassname, |
array $ | primaryKey | ||
) |
Called by parent table's class during delete() method.
string | $parentTableClassname | |
array | $primaryKey |
Definition at line 1175 of file Abstract.php.
_cascadeUpdate | ( | $ | parentTableClassname, |
array $ | oldPrimaryKey, | ||
array $ | newPrimaryKey | ||
) |
Called by a row object for the parent table's class during save() method.
string | $parentTableClassname | |
array | $oldPrimaryKey | |
array | $newPrimaryKey |
Definition at line 1124 of file Abstract.php.
_fetch | ( | Zend_Db_Table_Select $ | select ) | [protected] |
Support method for fetching rows.
Zend_Db_Table_Select | $select | query options. |
Definition at line 1507 of file Abstract.php.
_getCols | ( | ) | [protected] |
_getReferenceMapNormalized | ( | ) | [protected] |
Returns a normalized version of the reference map
Definition at line 919 of file Abstract.php.
_order | ( | Zend_Db_Table_Select $ | select, |
$ | order | ||
) | [protected] |
Generate ORDER clause from user-supplied string or array
string | array | $order | OPTIONAL An SQL ORDER clause. |
Definition at line 1488 of file Abstract.php.
_setAdapter | ( | $ | db ) | [protected] |
mixed | $db | Either an Adapter object, or a string naming a Registry key |
Definition at line 579 of file Abstract.php.
_setMetadataCache | ( | $ | metadataCache ) | [protected] |
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.
mixed | $metadataCache | Either a Cache object, or a string naming a Registry key |
Definition at line 650 of file Abstract.php.
_setSequence | ( | $ | sequence ) | [protected] |
Sets the sequence member, which defines the behavior for generating primary key values in new rows.
mixed | $sequence |
Definition at line 723 of file Abstract.php.
_setup | ( | ) | [protected] |
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.
Definition at line 737 of file Abstract.php.
static _setupAdapter | ( | $ | db ) | [static, protected] |
mixed | $db | Either an Adapter object, or a string naming a Registry key |
Zend_Db_Table_Exception |
Definition at line 600 of file Abstract.php.
_setupDatabaseAdapter | ( | ) | [protected] |
_setupMetadata | ( | ) | [protected] |
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.
Zend_Db_Table_Exception |
Definition at line 788 of file Abstract.php.
static _setupMetadataCache | ( | $ | metadataCache ) | [static, protected] |
mixed | $metadataCache | Either a Cache object, or a string naming a Registry key |
Zend_Db_Table_Exception |
Definition at line 695 of file Abstract.php.
_setupPrimaryKey | ( | ) | [protected] |
Initialize primary key from metadata. If $_primary is not defined, discover primary keys from the information returned by describeTable().
Zend_Db_Table_Exception |
Special case for PostgreSQL: a SERIAL key implicitly uses a sequence object whose name is "<table>_<column>_seq".
Definition at line 863 of file Abstract.php.
_setupTableName | ( | ) | [protected] |
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.
Definition at line 770 of file Abstract.php.
_where | ( | Zend_Db_Table_Select $ | select, |
$ | where | ||
) | [protected] |
Generate WHERE clause from user-supplied string or array
string | array | $where | OPTIONAL An SQL WHERE clause. |
Definition at line 1463 of file Abstract.php.
addReference | ( | $ | ruleKey, |
$ | columns, | ||
$ | refTableClass, | ||
$ | refColumns, | ||
$ | onDelete = null , |
||
$ | onUpdate = null |
||
) |
Add a reference to the reference map
string | $ruleKey | |
string | array | $columns | |
string | $refTableClass | |
string | array | $refColumns | |
string | $onDelete | |
string | $onUpdate |
Definition at line 423 of file Abstract.php.
createRow | ( | array $ | data = array() , |
$ | defaultSource = null |
||
) |
Fetches a new blank row (not from the database).
array | $data | OPTIONAL data to populate in the new row. |
string | $defaultSource | OPTIONAL flag to force default values into new row |
Definition at line 1410 of file Abstract.php.
delete | ( | $ | where ) |
Deletes existing rows.
array | string | $where | SQL WHERE clause(s). |
Definition at line 1162 of file Abstract.php.
fetchAll | ( | $ | where = null , |
$ | order = null , |
||
$ | count = null , |
||
$ | offset = null |
||
) |
Fetches all rows.
Honors the Zend_Db_Adapter fetch mode.
string | array | Zend_Db_Table_Select | $where | OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object. |
string | array | $order | OPTIONAL An SQL ORDER clause. |
int | $count | OPTIONAL An SQL LIMIT count. |
int | $offset | OPTIONAL An SQL LIMIT offset. |
Definition at line 1304 of file Abstract.php.
fetchNew | ( | ) |
Fetches a new blank row (not from the database).
Definition at line 1398 of file Abstract.php.
fetchRow | ( | $ | where = null , |
$ | 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.
string | array | Zend_Db_Table_Select | $where | OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object. |
string | array | $order | OPTIONAL An SQL ORDER clause. |
Definition at line 1352 of file Abstract.php.
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.
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.
mixed | $key | The value(s) of the primary keys. |
Zend_Db_Table_Exception |
Definition at line 1221 of file Abstract.php.
getAdapter | ( | ) |
Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.
Definition at line 590 of file Abstract.php.
static getDefaultAdapter | ( | ) | [static] |
Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
Definition at line 570 of file Abstract.php.
static getDefaultMetadataCache | ( | ) | [static] |
Gets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
Definition at line 634 of file Abstract.php.
getDefaultSource | ( | ) |
returns the default source flag that determines where defaultSources come from
Definition at line 527 of file Abstract.php.
getDefinition | ( | ) |
getDefinitionConfigName | ( | ) |
getDependentTables | ( | ) |
Definition at line 501 of file Abstract.php.
getMetadataCache | ( | ) |
Gets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
Definition at line 661 of file Abstract.php.
getReference | ( | $ | tableClassname, |
$ | ruleKey = null |
||
) |
string | $tableClassname | |
string | $ruleKey | OPTIONAL |
Zend_Db_Table_Exception |
Definition at line 460 of file Abstract.php.
getRowClass | ( | ) |
Definition at line 388 of file Abstract.php.
getRowsetClass | ( | ) |
Definition at line 407 of file Abstract.php.
info | ( | $ | key = null ) |
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.
$key | The specific info part to return OPTIONAL |
Definition at line 971 of file Abstract.php.
init | ( | ) |
Initialize object
Called from __construct() as final step of object instantiation.
Definition at line 958 of file Abstract.php.
insert | ( | array $ | data ) |
Inserts a new row.
array | $data | Column-value pairs. |
Zend_Db_Table assumes that if you have a compound primary key and one of the columns in the key uses a sequence, it's the _first_ column in the compound key.
If this table uses a database sequence object and the data does not specify a value, then get the next ID from the sequence and add it to the row. We assume that only the first column in a compound primary key takes a value from a sequence.
If the primary key can be generated automatically, and no value was specified in the user-supplied data, then omit it from the tuple.
INSERT the new row.
Fetch the most recent ID generated by an auto-increment or IDENTITY column, unless the user has specified a value, overriding the auto-increment mechanism.
Return the primary key value if the PK is a single column, else return an associative array of the PK column/value pairs.
Definition at line 1022 of file Abstract.php.
isIdentity | ( | $ | column ) |
Check if the provided column is an identity of the table
string | $column |
Zend_Db_Table_Exception |
Definition at line 1087 of file Abstract.php.
metadataCacheInClass | ( | ) |
Retrieve flag indicating if metadata should be cached for duration of instance
Definition at line 685 of file Abstract.php.
select | ( | $ | withFromPart = self::SELECT_WITHOUT_FROM_PART ) |
Returns an instance of a Zend_Db_Table_Select object.
bool | $withFromPart | Whether or not to include the from part of the select based on the table |
Definition at line 1006 of file Abstract.php.
static setDefaultAdapter | ( | $ | db = null ) |
[static] |
Sets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
mixed | $db | Either an Adapter object, or a string naming a Registry key |
Definition at line 560 of file Abstract.php.
static setDefaultMetadataCache | ( | $ | metadataCache = null ) |
[static] |
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.
mixed | $metadataCache | Either a Cache object, or a string naming a Registry key |
Definition at line 624 of file Abstract.php.
setDefaultSource | ( | $ | defaultSource = self::DEFAULT_NONE ) |
set the defaultSource property - this tells the table class where to find default values
string | $defaultSource |
Definition at line 512 of file Abstract.php.
setDefaultValues | ( | Array $ | defaultValues ) |
set the default values for the table class
array | $defaultValues |
Definition at line 538 of file Abstract.php.
setDefinition | ( | Zend_Db_Table_Definition $ | definition ) |
Zend_Db_Table_Definition | $definition |
Definition at line 336 of file Abstract.php.
setDefinitionConfigName | ( | $ | definitionConfigName ) |
string | $definition |
Definition at line 358 of file Abstract.php.
setDependentTables | ( | array $ | dependentTables ) |
array | $dependentTables |
Definition at line 491 of file Abstract.php.
setMetadataCacheInClass | ( | $ | flag ) |
Indicate whether metadata should be cached in the class for the duration of the instance
bool | $flag |
Definition at line 673 of file Abstract.php.
setOptions | ( | Array $ | options ) |
array | $options |
Definition at line 278 of file Abstract.php.
setReferences | ( | array $ | referenceMap ) |
array | $referenceMap |
Definition at line 447 of file Abstract.php.
setRowClass | ( | $ | classname ) |
string | $classname |
Definition at line 378 of file Abstract.php.
setRowsetClass | ( | $ | classname ) |
string | $classname |
Definition at line 397 of file Abstract.php.
update | ( | array $ | data, |
$ | where | ||
) |
Updates existing rows.
array | $data | Column-value pairs. |
array | string | $where | An SQL WHERE clause, or an array of SQL WHERE clauses. |
Definition at line 1110 of file Abstract.php.