category Zend
package Zend_Db
subpackage Table
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Turn magic function calls into non-magic function calls to the above methods.

__call(string $method, array $args) : \Zend_Db_Table_Row_Abstract | \Zend_Db_Table_Rowset_Abstract

Parameters

$method

string

$args

array

OPTIONAL Zend_Db_Table_Select query modifier

Exceptions

\Zend_Db_Table_Row_Exception If an invalid method is called.

Returns

\Zend_Db_Table_Row_Abstract\Zend_Db_Table_Rowset_Abstract

Constructor.

__construct(array $config = array()) : void

Supported params for $config are:-

  • table = class name or object of type Zend_Db_Table_Abstract
  • data = values of columns in this row.

Parameters

$config

array

OPTIONAL Array of user-specified config options.

Exceptions

\Zend_Db_Table_Row_Exception

Retrieve row field value

__get(string $columnName) : string

Parameters

$columnName

string

The user-specified column name.

Exceptions

\Zend_Db_Table_Row_Exception if the $columnName is not a column in the row.

Returns

stringThe corresponding column value.

Test existence of row field

__isset(string $columnName) : boolean

Parameters

$columnName

string

The column key.

Returns

boolean

Set row field value

__set(string $columnName, mixed $value) : void

Parameters

$columnName

string

The column key.

$value

mixed

The value for the property.

Exceptions

\Zend_Db_Table_Row_Exception

Store table, primary key and data in serialized object

__sleep() : array

Returns

array

Unset row field value

__unset(string $columnName) : \Zend_Db_Table_Row_Abstract

Parameters

$columnName

string

The column key.

Exceptions

\Zend_Db_Table_Row_Exception

Returns

\Zend_Db_Table_Row_Abstract

Setup to do on wakeup.

__wakeup() : void

A de-serialized Row should not be assumed to have access to a live database connection, so set _connected = false.

Deletes existing rows.

delete() : integer

Returns

integerThe number of rows deleted.

Query a dependent table to retrieve rows matching the current row.

findDependentRowset(string|\Zend_Db_Table_Abstract $dependentTable, $ruleKey = null, \Zend_Db_Table_Select $select = null) : \Zend_Db_Table_Rowset_Abstract

Parameters

$dependentTable

string\Zend_Db_Table_Abstract

$ruleKey

$select

Exceptions

\Zend_Db_Table_Row_Exception If $dependentTable is not a table or is not loadable.

Returns

\Zend_Db_Table_Rowset_AbstractQuery result from $dependentTable

findManyToManyRowset()

findManyToManyRowset(string|\Zend_Db_Table_Abstract $matchTable, string|\Zend_Db_Table_Abstract $intersectionTable, $callerRefRule = null, $matchRefRule = null, \Zend_Db_Table_Select $select = null) : \Zend_Db_Table_Rowset_Abstract

Parameters

$matchTable

string\Zend_Db_Table_Abstract

$intersectionTable

string\Zend_Db_Table_Abstract

$callerRefRule

$matchRefRule

$select

Exceptions

\Zend_Db_Table_Row_Exception If $matchTable or $intersectionTable is not a table class or is not loadable.

Returns

\Zend_Db_Table_Rowset_AbstractQuery result from $matchTable

Query a parent table to retrieve the single row matching the current row.

findParentRow(string|\Zend_Db_Table_Abstract $parentTable, $ruleKey = null, \Zend_Db_Table_Select $select = null) : \Zend_Db_Table_Row_Abstract

Parameters

$parentTable

string\Zend_Db_Table_Abstract

$ruleKey

$select

Exceptions

\Zend_Db_Table_Row_Exception If $parentTable is not a table or is not loadable.

Returns

\Zend_Db_Table_Row_AbstractQuery result from $parentTable

getIterator()

getIterator() 

Retrieves an associative array of primary keys.

getPrimaryKey(boolean $useDirty = true) : array

Parameters

$useDirty

boolean

Returns

array

Returns the table object, or null if this is disconnected row

getTable() : \Zend_Db_Table_Abstract | null

Returns

\Zend_Db_Table_Abstractnull

Query the class name of the Table object for which this Row was created.

getTableClass() : string

Returns

string

Initialize object

init() : void

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

Test the connected status of the row.

isConnected() : boolean

Returns

boolean

Test the read-only status of the row.

isReadOnly() : boolean

Returns

boolean

Proxy to __isset Required by the ArrayAccess implementation

offsetExists(string $offset) : boolean

Parameters

$offset

string

Returns

boolean

Proxy to __get Required by the ArrayAccess implementation

offsetGet(string $offset) : string

Parameters

$offset

string

Returns

string

Proxy to __set Required by the ArrayAccess implementation

offsetSet(string $offset, mixed $value) 

Parameters

$offset

string

$value

mixed

Proxy to __unset Required by the ArrayAccess implementation

offsetUnset(string $offset) 

Parameters

$offset

string

Refreshes properties from the database.

refresh() : void

Saves the properties to the database.

save() : mixed

This performs an intelligent insert/update, and reloads the properties with fresh data from the table on success.

Returns

mixedThe primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column.

Returns an instance of the parent table's Zend_Db_Table_Select object.

select() : \Zend_Db_Table_Select

Returns

\Zend_Db_Table_Select

Sets all data in the row from an array.

setFromArray(array $data) : \Zend_Db_Table_Row_Abstract

Parameters

$data

array

Returns

\Zend_Db_Table_Row_AbstractProvides a fluent interface

Set the read-only status of the row.

setReadOnly(boolean $flag) : boolean

Parameters

$flag

boolean

Returns

boolean

Set the table object, to re-establish a live connection to the database for a Row that has been de-serialized.

setTable(\Zend_Db_Table_Abstract $table = null) : boolean

Parameters

$table

\Zend_Db_Table_Abstract

Exceptions

\Zend_Db_Table_Row_Exception

Returns

boolean

Returns the column/value data as an array.

toArray() : array

Returns

array

Allows pre-delete logic to be applied to row.

_delete() : void

Subclasses may override this method.

_doInsert()

_doInsert() : mixed

Returns

mixedThe primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column.

_doUpdate()

_doUpdate() : mixed

Returns

mixedThe primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column.

Retrieves an associative array of primary keys.

_getPrimaryKey(boolean $useDirty = true) : array

Parameters

$useDirty

boolean

Returns

array

Retrieves an instance of the parent table.

_getTable() : \Zend_Db_Table_Abstract

Returns

\Zend_Db_Table_Abstract

_getTableFromString

_getTableFromString(string $tableName) : \Zend_Db_Table_Abstract

Parameters

$tableName

string

Returns

\Zend_Db_Table_Abstract

Constructs where statement for retrieving row(s).

_getWhereQuery(boolean $useDirty = true) : array

Parameters

$useDirty

boolean

Returns

array

Allows pre-insert logic to be applied to row.

_insert() : void

Subclasses may override this method.

Allows post-delete logic to be applied to row.

_postDelete() : void

Subclasses may override this method.

Allows post-insert logic to be applied to row.

_postInsert() : void

Subclasses may override this method.

Allows post-update logic to be applied to row.

_postUpdate() : void

Subclasses may override this method.

Prepares a table reference for lookup.

_prepareReference(\Zend_Db_Table_Abstract $dependentTable, \Zend_Db_Table_Abstract $parentTable, string $ruleKey) : array

Ensures all reference keys are set and properly formatted.

Parameters

$dependentTable

\Zend_Db_Table_Abstract

$parentTable

\Zend_Db_Table_Abstract

$ruleKey

string

Returns

array

Refreshes properties from the database.

_refresh() : void

Transform a column name from the user-specified form to the physical form used in the database.

_transformColumn(string $columnName) : string

You can override this method in a custom Row class to implement column name mappings, for example inflection.

Parameters

$columnName

string

Column name given.

Exceptions

\Zend_Db_Table_Row_Exception if the $columnName is not a string.

Returns

stringThe column name after transformation applied (none by default).

Allows pre-update logic to be applied to row.

_update() : void

Subclasses may override this method.

 Properties

 

This is set to a copy of $_data when the data is fetched from a database, specified as a new tuple in the constructor, or when dirty data is posted to the database with save().

$_cleanData : array

Default

array()
 

Connected is true if we have a reference to a live Zend_Db_Table_Abstract object.

$_connected : boolean

Default

true

This is false after the Rowset has been deserialized.

 

The data for each column in the row (column_name => value).

$_data : array

Default

array()

The keys must match the physical names of columns in the table for which this row is defined.

 

Tracks columns where data has been updated. Allows more specific insert and update operations.

$_modifiedFields : array

Default

array()
 

Primary row key(s).

$_primary : array

Default

 

A row is marked read only if it contains columns that are not physically represented within the database schema (e.g. evaluated columns/Zend_Db_Expr columns). This can also be passed as a run-time config options as a means of protecting row data.

$_readOnly : boolean

Default

false
 

Zend_Db_Table_Abstract parent class or instance.

$_table : \Zend_Db_Table_Abstract

Default

null
 

Name of the class of the Zend_Db_Table_Abstract object.

$_tableClass : string

Default

null