Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
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, $offset=null) | |
fetchNew () | |
createRow (array $data=array(), $defaultSource=null) | |
Static Public Member Functions | |
static | setDefaultAdapter ($db=null) |
static | getDefaultAdapter () |
static | setDefaultMetadataCache ($metadataCache=null) |
static | getDefaultMetadataCache () |
static | getTableFromString ($tableName, Zend_Db_Table_Abstract $referenceTable=null) |
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 | CASCADE_RECURSE = 'cascadeRecurse' |
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 256 of file Abstract.php.
_cascadeDelete | ( | $parentTableClassname, | |
array | $primaryKey | ||
) |
Called by parent table's class during delete() method.
string | $parentTableClassname | |
array | $primaryKey |
Execute cascading deletes against dependent tables
Definition at line 1213 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 1144 of file Abstract.php.
|
protected |
Support method for fetching rows.
Zend_Db_Table_Select | $select | query options. |
Definition at line 1591 of file Abstract.php.
|
protected |
|
protected |
Returns a normalized version of the reference map
Definition at line 928 of file Abstract.php.
|
protected |
Generate ORDER clause from user-supplied string or array
string | array | $order | OPTIONAL An SQL ORDER clause. |
Definition at line 1572 of file Abstract.php.
|
protected |
mixed | $db | Either an Adapter object, or a string naming a Registry key |
Definition at line 580 of file Abstract.php.
|
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 651 of file Abstract.php.
|
protected |
Sets the sequence member, which defines the behavior for generating primary key values in new rows.
mixed | $sequence |
Definition at line 724 of file Abstract.php.
|
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 738 of file Abstract.php.
|
staticprotected |
mixed | $db | Either an Adapter object, or a string naming a Registry key |
Zend_Db_Table_Exception |
Definition at line 601 of file Abstract.php.
|
protected |
Initialize database adapter.
Zend_Db_Table_Exception |
Definition at line 750 of file Abstract.php.
|
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 790 of file Abstract.php.
|
staticprotected |
mixed | $metadataCache | Either a Cache object, or a string naming a Registry key |
Zend_Db_Table_Exception |
Definition at line 696 of file Abstract.php.
|
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 872 of file Abstract.php.
|
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 772 of file Abstract.php.
|
protected |
Generate WHERE clause from user-supplied string or array
string | array | $where | OPTIONAL An SQL WHERE clause. |
Definition at line 1547 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 424 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 1494 of file Abstract.php.
delete | ( | $where | ) |
Deletes existing rows.
array | string | $where | SQL WHERE clause(s). |
Execute cascading deletes against dependent tables
Definition at line 1182 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 1387 of file Abstract.php.
fetchNew | ( | ) |
Fetches a new blank row (not from the database).
Definition at line 1482 of file Abstract.php.
fetchRow | ( | $where = null , |
|
$order = null , |
|||
$offset = 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. |
int | $offset | OPTIONAL An SQL OFFSET value. |
Definition at line 1436 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 |
PHP 7.2 PATCH -->
PHP 7.2 PATCH <–
Definition at line 1288 of file Abstract.php.
getAdapter | ( | ) |
Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Table object.
Definition at line 591 of file Abstract.php.
|
static |
Gets the default Zend_Db_Adapter_Abstract for all Zend_Db_Table objects.
Definition at line 571 of file Abstract.php.
|
static |
Gets the default metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
Definition at line 635 of file Abstract.php.
getDefaultSource | ( | ) |
returns the default source flag that determines where defaultSources come from
Definition at line 528 of file Abstract.php.
getDefaultValues | ( | ) |
Definition at line 549 of file Abstract.php.
getDefinition | ( | ) |
getDefinitionConfigName | ( | ) |
getDependentTables | ( | ) |
getMetadataCache | ( | ) |
Gets the metadata cache for information returned by Zend_Db_Adapter_Abstract::describeTable().
Definition at line 662 of file Abstract.php.
getReference | ( | $tableClassname, | |
$ruleKey = null |
|||
) |
string | $tableClassname | |
string | $ruleKey | OPTIONAL |
Zend_Db_Table_Exception |
Definition at line 461 of file Abstract.php.
getRowClass | ( | ) |
getRowsetClass | ( | ) |
|
static |
Get table gateway object from string
string | $tableName | |
Zend_Db_Table_Abstract | $referenceTable |
Zend_Db_Table_Row_Exception |
Definition at line 1606 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.
string | $key | The specific info part to return OPTIONAL |
Zend_Db_Table_Exception |
Definition at line 981 of file Abstract.php.
init | ( | ) |
Initialize object
Called from __construct() as final step of object instantiation.
Definition at line 967 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 the primary key can be generated automatically, and no value was specified in the user-supplied data, then omit it from the tuple.
Note: this checks for sensible values in the supplied primary key position of the data. The following values are considered empty: null, false, true, '', array()
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.
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 1032 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 1107 of file Abstract.php.
metadataCacheInClass | ( | ) |
Retrieve flag indicating if metadata should be cached for duration of instance
Definition at line 686 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 1016 of file Abstract.php.
|
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 561 of file Abstract.php.
|
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 625 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 513 of file Abstract.php.
setDefaultValues | ( | Array | $defaultValues | ) |
set the default values for the table class
array | $defaultValues |
Definition at line 539 of file Abstract.php.
setDefinition | ( | Zend_Db_Table_Definition | $definition | ) |
Zend_Db_Table_Definition | $definition |
Definition at line 337 of file Abstract.php.
setDefinitionConfigName | ( | $definitionConfigName | ) |
string | $definition |
Definition at line 359 of file Abstract.php.
setDependentTables | ( | array | $dependentTables | ) |
array | $dependentTables |
Definition at line 492 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 674 of file Abstract.php.
setOptions | ( | Array | $options | ) |
array | $options |
Definition at line 279 of file Abstract.php.
setReferences | ( | array | $referenceMap | ) |
array | $referenceMap |
Definition at line 448 of file Abstract.php.
setRowClass | ( | $classname | ) |
string | $classname |
Definition at line 379 of file Abstract.php.
setRowsetClass | ( | $classname | ) |
string | $classname |
Definition at line 398 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 1130 of file Abstract.php.
|
protected |
Definition at line 138 of file Abstract.php.
|
protected |
Definition at line 117 of file Abstract.php.
|
staticprotected |
Definition at line 89 of file Abstract.php.
|
staticprotected |
Definition at line 110 of file Abstract.php.
|
protected |
Definition at line 235 of file Abstract.php.
|
protected |
Definition at line 236 of file Abstract.php.
|
protected |
Definition at line 96 of file Abstract.php.
|
protected |
Definition at line 103 of file Abstract.php.
|
protected |
Definition at line 232 of file Abstract.php.
|
protected |
Definition at line 160 of file Abstract.php.
|
protected |
Definition at line 175 of file Abstract.php.
|
protected |
Definition at line 182 of file Abstract.php.
|
protected |
Definition at line 188 of file Abstract.php.
|
protected |
Definition at line 131 of file Abstract.php.
|
protected |
Definition at line 148 of file Abstract.php.
|
protected |
Definition at line 222 of file Abstract.php.
|
protected |
Definition at line 195 of file Abstract.php.
|
protected |
Definition at line 202 of file Abstract.php.
|
protected |
Definition at line 124 of file Abstract.php.
|
protected |
Definition at line 168 of file Abstract.php.
const ADAPTER = 'db' |
Definition at line 50 of file Abstract.php.
const CASCADE = 'cascade' |
Definition at line 72 of file Abstract.php.
const CASCADE_RECURSE = 'cascadeRecurse' |
Definition at line 73 of file Abstract.php.
const COLS = 'cols' |
Definition at line 56 of file Abstract.php.
const COLUMNS = 'columns' |
Definition at line 66 of file Abstract.php.
const DEFAULT_CLASS = 'defaultClass' |
Definition at line 78 of file Abstract.php.
const DEFAULT_DB = 'defaultDb' |
Definition at line 79 of file Abstract.php.
const DEFAULT_NONE = 'defaultNone' |
Definition at line 77 of file Abstract.php.
const DEFINITION = 'definition' |
Definition at line 51 of file Abstract.php.
const DEFINITION_CONFIG_NAME = 'definitionConfigName' |
Definition at line 52 of file Abstract.php.
const DEPENDENT_TABLES = 'dependentTables' |
Definition at line 63 of file Abstract.php.
const METADATA = 'metadata' |
Definition at line 57 of file Abstract.php.
const METADATA_CACHE = 'metadataCache' |
Definition at line 58 of file Abstract.php.
const METADATA_CACHE_IN_CLASS = 'metadataCacheInClass' |
Definition at line 59 of file Abstract.php.
const NAME = 'name' |
Definition at line 54 of file Abstract.php.
const ON_DELETE = 'onDelete' |
Definition at line 69 of file Abstract.php.
const ON_UPDATE = 'onUpdate' |
Definition at line 70 of file Abstract.php.
const PRIMARY = 'primary' |
Definition at line 55 of file Abstract.php.
const REF_COLUMNS = 'refColumns' |
Definition at line 68 of file Abstract.php.
const REF_TABLE_CLASS = 'refTableClass' |
Definition at line 67 of file Abstract.php.
const REFERENCE_MAP = 'referenceMap' |
Definition at line 62 of file Abstract.php.
const RESTRICT = 'restrict' |
Definition at line 74 of file Abstract.php.
const ROW_CLASS = 'rowClass' |
Definition at line 60 of file Abstract.php.
const ROWSET_CLASS = 'rowsetClass' |
Definition at line 61 of file Abstract.php.
const SCHEMA = 'schema' |
Definition at line 53 of file Abstract.php.
const SELECT_WITH_FROM_PART = true |
Definition at line 81 of file Abstract.php.
const SELECT_WITHOUT_FROM_PART = false |
Definition at line 82 of file Abstract.php.
const SEQUENCE = 'sequence' |
Definition at line 64 of file Abstract.php.
const SET_NULL = 'setNull' |
Definition at line 75 of file Abstract.php.