PHP Класс Zend_Db_Table_Abstract

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_cols array The table column names derived from Zend_Db_Adapter_Abstract::describeTable().
$_db Zend_Db_Adapter_Abstract Zend_Db_Adapter_Abstract object.
$_defaultDb Zend_Db_Adapter_Abstract Default Zend_Db_Adapter_Abstract object.
$_defaultMetadataCache Zend_Cache_Core Default cache for information provided by the adapter's describeTable() method.
$_defaultSource
$_defaultValues
$_definition unknown_type Optional Zend_Db_Table_Definition object
$_definitionConfigName string Optional definition config name used in concrete implementation
$_dependentTables array Array elements are not table names; they are class names of classes that extend Zend_Db_Table_Abstract.
$_identity integer 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.
$_metadata array Information provided by the adapter's describeTable() method.
$_metadataCache Zend_Cache_Core Cache for information provided by the adapter's describeTable() method.
$_metadataCacheInClass boolean Flag: whether or not to cache metadata in the class
$_name string The table name.
$_primary mixed A compound key should be declared as an array. You may declare a single-column primary key as a string.
$_referenceMap array 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.
$_rowClass string Classname for row
$_rowsetClass string Classname for rowset
$_schema array The schema name (default null means current schema)
$_sequence mixed May be a string, boolean true, or boolean false.

Открытые методы

Метод Описание
__construct ( mixed $config = [] ) : void Constructor.
_cascadeDelete ( string $parentTableClassname, array $primaryKey ) : integer Called by parent table's class during delete() method.
_cascadeUpdate ( string $parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey ) : integer Called by a row object for the parent table's class during save() method.
addReference ( string $ruleKey, string | array $columns, string $refTableClass, string | array $refColumns, string $onDelete = null, string $onUpdate = null ) : Zend_Db_Table_Abstract Add a reference to the reference map
createRow ( array $data = [], string $defaultSource = null ) : Zend_Db_Table_Row_Abstract Fetches a new blank row (not from the database).
delete ( array | string $where ) : integer Deletes existing rows.
fetchAll ( string | array | Zend_Db_Table_Select $where = null, string | array $order = null, integer $count = null, integer $offset = null ) : Zend_Db_Table_Rowset_Abstract Fetches all rows.
fetchNew ( ) : Zend_Db_Table_Row_Abstract Fetches a new blank row (not from the database).
fetchRow ( string | array | Zend_Db_Table_Select $where = null, string | array $order = null, integer $offset = null ) : Zend_Db_Table_Row_Abstract | null Fetches one row in an object of type Zend_Db_Table_Row_Abstract, or returns null if no row matches the specified criteria.
find ( ) : Zend_Db_Table_Rowset_Abstract 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.
getAdapter ( ) : Zend_Db_Adapter_Abstract Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.
getDefaultAdapter ( ) : Zend_Db_Adapter_Abstract Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
getDefaultMetadataCache ( ) : Zend_Cache_Core Gets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
getDefaultSource ( ) : unknown returns the default source flag that determines where defaultSources come from
getDefaultValues ( )
getDefinition ( ) : Zend_Db_Table_Definition | null getDefinition()
getDefinitionConfigName ( ) : string getDefinitionConfigName()
getDependentTables ( ) : array
getMetadataCache ( ) : Zend_Cache_Core Gets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
getReference ( string $tableClassname, string $ruleKey = null ) : array
getRowClass ( ) : string
getRowsetClass ( ) : string
info ( string $key = null ) : mixed Returns table information.
init ( ) : void Initialize object
insert ( array $data ) : mixed Inserts a new row.
isIdentity ( string $column ) : boolean Check if the provided column is an identity of the table
metadataCacheInClass ( ) : boolean Retrieve flag indicating if metadata should be cached for duration of instance
select ( boolean $withFromPart = self::SELECT_WITHOUT_FROM_PART ) : Zend_Db_Table_Select Returns an instance of a Zend_Db_Table_Select object.
setDefaultAdapter ( mixed $db = null ) : void Sets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
setDefaultMetadataCache ( mixed $metadataCache = null ) : void Sets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
setDefaultSource ( string $defaultSource = self::DEFAULT_NONE ) : Zend_Db_Table_Abstract set the defaultSource property - this tells the table class where to find default values
setDefaultValues ( array $defaultValues ) : Zend_Db_Table_Abstract set the default values for the table class
setDefinition ( Zend_Db_Table_Definition $definition ) : Zend_Db_Table_Abstract setDefinition()
setDefinitionConfigName ( $definitionConfigName ) : Zend_Db_Table_Abstract setDefinitionConfigName()
setDependentTables ( array $dependentTables ) : Zend_Db_Table_Abstract
setMetadataCacheInClass ( boolean $flag ) : Zend_Db_Table_Abstract Indicate whether metadata should be cached in the class for the duration of the instance
setOptions ( array $options ) : Zend_Db_Table_Abstract setOptions()
setReferences ( array $referenceMap ) : Zend_Db_Table_Abstract
setRowClass ( string $classname ) : Zend_Db_Table_Abstract
setRowsetClass ( string $classname ) : Zend_Db_Table_Abstract
update ( array $data, array | string $where ) : integer Updates existing rows.

Защищенные методы

Метод Описание
_fetch ( Zend_Db_Table_Select $select ) : array Support method for fetching rows.
_getCols ( ) : array Retrieve table columns
_getReferenceMapNormalized ( ) : array Returns a normalized version of the reference map
_order ( Zend_Db_Table_Select $select, string | array $order ) : Zend_Db_Table_Select Generate ORDER clause from user-supplied string or array
_setAdapter ( mixed $db ) : Zend_Db_Table_Abstract
_setMetadataCache ( mixed $metadataCache ) : Zend_Db_Table_Abstract Sets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
_setSequence ( mixed $sequence ) : Zend_Db_Table_Adapter_Abstract Sets the sequence member, which defines the behavior for generating primary key values in new rows.
_setup ( ) : void Turnkey for initialization of a table object.
_setupAdapter ( mixed $db ) : Zend_Db_Adapter_Abstract
_setupDatabaseAdapter ( ) : void Initialize database adapter.
_setupMetadata ( ) : boolean Initializes metadata.
_setupMetadataCache ( mixed $metadataCache ) : Zend_Cache_Core
_setupPrimaryKey ( ) : void Initialize primary key from metadata.
_setupTableName ( ) : void Initialize table and schema names.
_where ( Zend_Db_Table_Select $select, string | array $where ) : Zend_Db_Table_Select Generate WHERE clause from user-supplied string or array

Описание методов

__construct() публичный Метод

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().
public __construct ( mixed $config = [] ) : void
$config mixed Array of user-specified config options, or just the Db Adapter.
Результат void

_cascadeDelete() публичный Метод

Called by parent table's class during delete() method.
public _cascadeDelete ( string $parentTableClassname, array $primaryKey ) : integer
$parentTableClassname string
$primaryKey array
Результат integer Number of affected rows

_cascadeUpdate() публичный Метод

Called by a row object for the parent table's class during save() method.
public _cascadeUpdate ( string $parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey ) : integer
$parentTableClassname string
$oldPrimaryKey array
$newPrimaryKey array
Результат integer

_fetch() защищенный Метод

Support method for fetching rows.
protected _fetch ( Zend_Db_Table_Select $select ) : array
$select Zend_Db_Table_Select query options.
Результат array An array containing the row results in FETCH_ASSOC mode.

_getCols() защищенный Метод

Retrieve table columns
protected _getCols ( ) : array
Результат array

_getReferenceMapNormalized() защищенный Метод

Returns a normalized version of the reference map
protected _getReferenceMapNormalized ( ) : array
Результат array

_order() защищенный Метод

Generate ORDER clause from user-supplied string or array
protected _order ( Zend_Db_Table_Select $select, string | array $order ) : Zend_Db_Table_Select
$select Zend_Db_Table_Select
$order string | array OPTIONAL An SQL ORDER clause.
Результат Zend_Db_Table_Select

_setAdapter() защищенный Метод

protected _setAdapter ( mixed $db ) : Zend_Db_Table_Abstract
$db mixed Either an Adapter object, or a string naming a Registry key
Результат Zend_Db_Table_Abstract Provides a fluent interface

_setMetadataCache() защищенный Метод

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.
protected _setMetadataCache ( mixed $metadataCache ) : Zend_Db_Table_Abstract
$metadataCache mixed Either a Cache object, or a string naming a Registry key
Результат Zend_Db_Table_Abstract Provides a fluent interface

_setSequence() защищенный Метод

- 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.
protected _setSequence ( mixed $sequence ) : Zend_Db_Table_Adapter_Abstract
$sequence mixed
Результат Zend_Db_Table_Adapter_Abstract Provides a fluent interface

_setup() защищенный Метод

Calls other protected methods for individual tasks, to make it easier for a subclass to override part of the setup logic.
protected _setup ( ) : void
Результат void

_setupAdapter() защищенный статический Метод

protected static _setupAdapter ( mixed $db ) : Zend_Db_Adapter_Abstract
$db mixed Either an Adapter object, or a string naming a Registry key
Результат Zend_Db_Adapter_Abstract

_setupDatabaseAdapter() защищенный Метод

Initialize database adapter.
protected _setupDatabaseAdapter ( ) : void
Результат void

_setupMetadata() защищенный Метод

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.
protected _setupMetadata ( ) : boolean
Результат boolean

_setupMetadataCache() защищенный статический Метод

protected static _setupMetadataCache ( mixed $metadataCache ) : Zend_Cache_Core
$metadataCache mixed Either a Cache object, or a string naming a Registry key
Результат Zend_Cache_Core

_setupPrimaryKey() защищенный Метод

If $_primary is not defined, discover primary keys from the information returned by describeTable().
protected _setupPrimaryKey ( ) : void
Результат void

_setupTableName() защищенный Метод

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 _setupTableName ( ) : void
Результат void

_where() защищенный Метод

Generate WHERE clause from user-supplied string or array
protected _where ( Zend_Db_Table_Select $select, string | array $where ) : Zend_Db_Table_Select
$select Zend_Db_Table_Select
$where string | array OPTIONAL An SQL WHERE clause.
Результат Zend_Db_Table_Select

addReference() публичный Метод

Add a reference to the reference map
public addReference ( string $ruleKey, string | array $columns, string $refTableClass, string | array $refColumns, string $onDelete = null, string $onUpdate = null ) : Zend_Db_Table_Abstract
$ruleKey string
$columns string | array
$refTableClass string
$refColumns string | array
$onDelete string
$onUpdate string
Результат Zend_Db_Table_Abstract

createRow() публичный Метод

Fetches a new blank row (not from the database).
public createRow ( array $data = [], string $defaultSource = null ) : Zend_Db_Table_Row_Abstract
$data array OPTIONAL data to populate in the new row.
$defaultSource string OPTIONAL flag to force default values into new row
Результат Zend_Db_Table_Row_Abstract

delete() публичный Метод

Deletes existing rows.
public delete ( array | string $where ) : integer
$where array | string SQL WHERE clause(s).
Результат integer The number of rows deleted.

fetchAll() публичный Метод

Honors the Zend_Db_Adapter fetch mode.
public fetchAll ( string | array | Zend_Db_Table_Select $where = null, string | array $order = null, integer $count = null, integer $offset = null ) : Zend_Db_Table_Rowset_Abstract
$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.
Результат Zend_Db_Table_Rowset_Abstract The row results per the Zend_Db_Adapter fetch mode.

fetchNew() публичный Метод

Fetches a new blank row (not from the database).
Устаревший: since 0.9.3 - use createRow() instead.
public fetchNew ( ) : Zend_Db_Table_Row_Abstract
Результат Zend_Db_Table_Row_Abstract

fetchRow() публичный Метод

Fetches one row in an object of type Zend_Db_Table_Row_Abstract, or returns null if no row matches the specified criteria.
public fetchRow ( string | array | Zend_Db_Table_Select $where = null, string | array $order = null, integer $offset = null ) : Zend_Db_Table_Row_Abstract | null
$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.
$offset integer OPTIONAL An SQL OFFSET value.
Результат Zend_Db_Table_Row_Abstract | null The row results per the Zend_Db_Adapter fetch mode, or null if no row found.

find() публичный Метод

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.
public find ( ) : Zend_Db_Table_Rowset_Abstract
Результат Zend_Db_Table_Rowset_Abstract Row(s) matching the criteria.

getAdapter() публичный Метод

Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.
public getAdapter ( ) : Zend_Db_Adapter_Abstract
Результат Zend_Db_Adapter_Abstract

getDefaultAdapter() публичный статический Метод

Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
public static getDefaultAdapter ( ) : Zend_Db_Adapter_Abstract
Результат Zend_Db_Adapter_Abstract or null

getDefaultMetadataCache() публичный статический Метод

Gets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
public static getDefaultMetadataCache ( ) : Zend_Cache_Core
Результат Zend_Cache_Core or null

getDefaultSource() публичный Метод

returns the default source flag that determines where defaultSources come from
public getDefaultSource ( ) : unknown
Результат unknown

getDefaultValues() публичный Метод

public getDefaultValues ( )

getDefinition() публичный Метод

getDefinition()
public getDefinition ( ) : Zend_Db_Table_Definition | null
Результат Zend_Db_Table_Definition | null

getDefinitionConfigName() публичный Метод

getDefinitionConfigName()
public getDefinitionConfigName ( ) : string
Результат string

getDependentTables() публичный Метод

public getDependentTables ( ) : array
Результат array

getMetadataCache() публичный Метод

Gets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
public getMetadataCache ( ) : Zend_Cache_Core
Результат Zend_Cache_Core or null

getReference() публичный Метод

public getReference ( string $tableClassname, string $ruleKey = null ) : array
$tableClassname string
$ruleKey string OPTIONAL
Результат array

getRowClass() публичный Метод

public getRowClass ( ) : string
Результат string

getRowsetClass() публичный Метод

public getRowsetClass ( ) : string
Результат string

info() публичный Метод

You can elect to return only a part of this information by supplying its key name, otherwise all information is returned as an array.
public info ( string $key = null ) : mixed
$key string The specific info part to return OPTIONAL
Результат mixed

init() публичный Метод

Called from {@link __construct()} as final step of object instantiation.
public init ( ) : void
Результат void

insert() публичный Метод

Inserts a new row.
public insert ( array $data ) : mixed
$data array Column-value pairs.
Результат mixed The primary key of the row inserted.

isIdentity() публичный Метод

Check if the provided column is an identity of the table
public isIdentity ( string $column ) : boolean
$column string
Результат boolean

metadataCacheInClass() публичный Метод

Retrieve flag indicating if metadata should be cached for duration of instance
public metadataCacheInClass ( ) : boolean
Результат boolean

select() публичный Метод

Returns an instance of a Zend_Db_Table_Select object.
public select ( boolean $withFromPart = self::SELECT_WITHOUT_FROM_PART ) : Zend_Db_Table_Select
$withFromPart boolean Whether or not to include the from part of the select based on the table
Результат Zend_Db_Table_Select

setDefaultAdapter() публичный статический Метод

Sets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
public static setDefaultAdapter ( mixed $db = null ) : void
$db mixed Either an Adapter object, or a string naming a Registry key
Результат void

setDefaultMetadataCache() публичный статический Метод

If $defaultMetadataCache is null, then no metadata cache is used by default.
public static setDefaultMetadataCache ( mixed $metadataCache = null ) : void
$metadataCache mixed Either a Cache object, or a string naming a Registry key
Результат void

setDefaultSource() публичный Метод

set the defaultSource property - this tells the table class where to find default values
public setDefaultSource ( string $defaultSource = self::DEFAULT_NONE ) : Zend_Db_Table_Abstract
$defaultSource string
Результат Zend_Db_Table_Abstract

setDefaultValues() публичный Метод

set the default values for the table class
public setDefaultValues ( array $defaultValues ) : Zend_Db_Table_Abstract
$defaultValues array
Результат Zend_Db_Table_Abstract

setDefinition() публичный Метод

setDefinition()
public setDefinition ( Zend_Db_Table_Definition $definition ) : Zend_Db_Table_Abstract
$definition Zend_Db_Table_Definition
Результат Zend_Db_Table_Abstract

setDefinitionConfigName() публичный Метод

setDefinitionConfigName()
public setDefinitionConfigName ( $definitionConfigName ) : Zend_Db_Table_Abstract
Результат Zend_Db_Table_Abstract

setDependentTables() публичный Метод

public setDependentTables ( array $dependentTables ) : Zend_Db_Table_Abstract
$dependentTables array
Результат Zend_Db_Table_Abstract Provides a fluent interface

setMetadataCacheInClass() публичный Метод

Indicate whether metadata should be cached in the class for the duration of the instance
public setMetadataCacheInClass ( boolean $flag ) : Zend_Db_Table_Abstract
$flag boolean
Результат Zend_Db_Table_Abstract

setOptions() публичный Метод

setOptions()
public setOptions ( array $options ) : Zend_Db_Table_Abstract
$options array
Результат Zend_Db_Table_Abstract

setReferences() публичный Метод

public setReferences ( array $referenceMap ) : Zend_Db_Table_Abstract
$referenceMap array
Результат Zend_Db_Table_Abstract Provides a fluent interface

setRowClass() публичный Метод

public setRowClass ( string $classname ) : Zend_Db_Table_Abstract
$classname string
Результат Zend_Db_Table_Abstract Provides a fluent interface

setRowsetClass() публичный Метод

public setRowsetClass ( string $classname ) : Zend_Db_Table_Abstract
$classname string
Результат Zend_Db_Table_Abstract Provides a fluent interface

update() публичный Метод

Updates existing rows.
public update ( array $data, array | string $where ) : integer
$data array Column-value pairs.
$where array | string An SQL WHERE clause, or an array of SQL WHERE clauses.
Результат integer The number of rows updated.

Описание свойств

$_cols защищенное свойство

The table column names derived from Zend_Db_Adapter_Abstract::describeTable().
protected array $_cols
Результат array

$_db защищенное свойство

Zend_Db_Adapter_Abstract object.
protected Zend_Db_Adapter_Abstract $_db
Результат Zend_Db_Adapter_Abstract

$_defaultDb защищенное статическое свойство

Default Zend_Db_Adapter_Abstract object.
protected static Zend_Db_Adapter_Abstract $_defaultDb
Результат Zend_Db_Adapter_Abstract

$_defaultMetadataCache защищенное статическое свойство

Default cache for information provided by the adapter's describeTable() method.
protected static Zend_Cache_Core $_defaultMetadataCache
Результат Zend_Cache_Core

$_defaultSource защищенное свойство

protected $_defaultSource

$_defaultValues защищенное свойство

protected $_defaultValues

$_definition защищенное свойство

Optional Zend_Db_Table_Definition object
protected unknown_type $_definition
Результат unknown_type

$_definitionConfigName защищенное свойство

Optional definition config name used in concrete implementation
protected string $_definitionConfigName
Результат string

$_dependentTables защищенное свойство

Array elements are not table names; they are class names of classes that extend Zend_Db_Table_Abstract.
protected array $_dependentTables
Результат array

$_identity защищенное свойство

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 int $_identity
Результат integer

$_metadata защищенное свойство

Information provided by the adapter's describeTable() method.
protected array $_metadata
Результат array

$_metadataCache защищенное свойство

Cache for information provided by the adapter's describeTable() method.
protected Zend_Cache_Core $_metadataCache
Результат Zend_Cache_Core

$_metadataCacheInClass защищенное свойство

Flag: whether or not to cache metadata in the class
protected bool $_metadataCacheInClass
Результат boolean

$_name защищенное свойство

The table name.
protected string $_name
Результат string

$_primary защищенное свойство

A compound key should be declared as an array. You may declare a single-column primary key as a string.
protected mixed $_primary
Результат mixed

$_referenceMap защищенное свойство

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 $_referenceMap
Результат array

$_rowClass защищенное свойство

Classname for row
protected string $_rowClass
Результат string

$_rowsetClass защищенное свойство

Classname for rowset
protected string $_rowsetClass
Результат string

$_schema защищенное свойство

The schema name (default null means current schema)
protected array $_schema
Результат array

$_sequence защищенное свойство

May be a string, boolean true, or boolean false.
protected mixed $_sequence
Результат mixed