Db/Table/Row.php
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 [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Db
- Subpackage
- Table
- Version
- $Id: Row.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Db_Table_Row
Reference concrete class that extends Zend_Db_Table_Row_Abstract.
Developers may also create their own classes that extend the abstract class.
- Parent(s)
- \Zend_Db_Table_Row_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

array $_cleanData = array()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().
Inherited from: \Zend_Db_Table_Row_Abstract::$$_cleanDataarray()Details- Type
- array
- Inherited_from
- \Zend_Db_Table_Row_Abstract::$$_cleanData

boolean $_connected = trueConnected is true if we have a reference to a live Zend_Db_Table_Abstract object.
Inherited from: \Zend_Db_Table_Row_Abstract::$$_connectedThis is false after the Rowset has been deserialized.
trueDetails- Type
- boolean
- Inherited_from
- \Zend_Db_Table_Row_Abstract::$$_connected

array $_data = array()The data for each column in the row (column_name => value).
Inherited from: \Zend_Db_Table_Row_Abstract::$$_dataThe keys must match the physical names of columns in the table for which this row is defined.
array()Details- Type
- array
- Inherited_from
- \Zend_Db_Table_Row_Abstract::$$_data

array $_modifiedFields = array()Tracks columns where data has been updated.
Inherited from: \Zend_Db_Table_Row_Abstract::$$_modifiedFieldsAllows more specific insert and update operations.
array()Details- Type
- array
- Inherited_from
- \Zend_Db_Table_Row_Abstract::$$_modifiedFields

boolean $_readOnly = falseA row is marked read only if it contains columns that are not physically represented within the database schema (e.g.
Inherited from: \Zend_Db_Table_Row_Abstract::$$_readOnlyevaluated columns/Zend_Db_Expr columns). This can also be passed as a run-time config options as a means of protecting row data.
falseDetails- Type
- boolean
- Inherited_from
- \Zend_Db_Table_Row_Abstract::$$_readOnly

\Zend_Db_Table_Abstract $_table = nullZend_Db_Table_Abstract parent class or instance.
Inherited from: \Zend_Db_Table_Row_Abstract::$$_tablenullDetails- Type
- \Zend_Db_Table_Abstract
- Inherited_from
- \Zend_Db_Table_Row_Abstract::$$_table

string $_tableClass = nullName of the class of the Zend_Db_Table_Abstract object.
Inherited from: \Zend_Db_Table_Row_Abstract::$$_tableClassnullDetails- Type
- string
- Inherited_from
- \Zend_Db_Table_Row_Abstract::$$_tableClass
Methods

__call(string $method, array $args) : \Zend_Db_Table_Row_Abstract | \Zend_Db_Table_Rowset_AbstractTurn magic function calls into non-magic function calls to the above methods.
Inherited from: \Zend_Db_Table_Row_Abstract::__call()| Name | Type | Description |
|---|---|---|
| $method | string | |
| $args | array | OPTIONAL Zend_Db_Table_Select query modifier |
| Type | Description |
|---|---|
| \Zend_Db_Table_Row_Abstract | \Zend_Db_Table_Rowset_Abstract |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception | If an invalid method is called. |

__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.
| Name | Type | Description |
|---|---|---|
| $config | array | OPTIONAL Array of user-specified config options. |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception |

__get(string $columnName) : string
| Name | Type | Description |
|---|---|---|
| $columnName | string | The user-specified column name. |
| Type | Description |
|---|---|
| string | The corresponding column value. |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception | if the $columnName is not a column in the row. |

__isset(string $columnName) : boolean
| Name | Type | Description |
|---|---|---|
| $columnName | string | The column key. |
| Type | Description |
|---|---|
| boolean |

__set(string $columnName, mixed $value) : void
| Name | Type | Description |
|---|---|---|
| $columnName | string | The column key. |
| $value | mixed | The value for the property. |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception |

__sleep() : arrayStore table, primary key and data in serialized object
Inherited from: \Zend_Db_Table_Row_Abstract::__sleep()| Type | Description |
|---|---|
| array |

__unset(string $columnName) : \Zend_Db_Table_Row_Abstract
| Name | Type | Description |
|---|---|---|
| $columnName | string | The column key. |
| Type | Description |
|---|---|
| \Zend_Db_Table_Row_Abstract |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception |

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

_delete() : voidAllows pre-delete logic to be applied to row.
Inherited from: \Zend_Db_Table_Row_Abstract::_delete()Subclasses may override this method.

_doInsert() : mixed| Type | Description |
|---|---|
| mixed | The primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column. |

_doUpdate() : mixed| Type | Description |
|---|---|
| mixed | The primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column. |

_getPrimaryKey(bool $useDirty = true) : arrayRetrieves an associative array of primary keys.
Inherited from: \Zend_Db_Table_Row_Abstract::_getPrimaryKey()| Name | Type | Description |
|---|---|---|
| $useDirty | bool |
| Type | Description |
|---|---|
| array |

_getTable() : \Zend_Db_Table_AbstractRetrieves an instance of the parent table.
Inherited from: \Zend_Db_Table_Row_Abstract::_getTable()| Type | Description |
|---|---|
| \Zend_Db_Table_Abstract |

_getTableFromString(string $tableName) : \Zend_Db_Table_Abstract
| Name | Type | Description |
|---|---|---|
| $tableName | string |
| Type | Description |
|---|---|
| \Zend_Db_Table_Abstract |

_getWhereQuery(bool $useDirty = true) : arrayConstructs where statement for retrieving row(s).
Inherited from: \Zend_Db_Table_Row_Abstract::_getWhereQuery()| Name | Type | Description |
|---|---|---|
| $useDirty | bool |
| Type | Description |
|---|---|
| array |

_insert() : voidAllows pre-insert logic to be applied to row.
Inherited from: \Zend_Db_Table_Row_Abstract::_insert()Subclasses may override this method.

_postDelete() : voidAllows post-delete logic to be applied to row.
Inherited from: \Zend_Db_Table_Row_Abstract::_postDelete()Subclasses may override this method.

_postInsert() : voidAllows post-insert logic to be applied to row.
Inherited from: \Zend_Db_Table_Row_Abstract::_postInsert()Subclasses may override this method.

_postUpdate() : voidAllows post-update logic to be applied to row.
Inherited from: \Zend_Db_Table_Row_Abstract::_postUpdate()Subclasses may override this method.

_prepareReference(\Zend_Db_Table_Abstract $dependentTable, \Zend_Db_Table_Abstract $parentTable, string $ruleKey) : arrayPrepares a table reference for lookup.
Inherited from: \Zend_Db_Table_Row_Abstract::_prepareReference()Ensures all reference keys are set and properly formatted.
| Name | Type | Description |
|---|---|---|
| $dependentTable | \Zend_Db_Table_Abstract | |
| $parentTable | \Zend_Db_Table_Abstract | |
| $ruleKey | string |
| Type | Description |
|---|---|
| array |

_refresh() : voidRefreshes properties from the database.
Inherited from: \Zend_Db_Table_Row_Abstract::_refresh()
_transformColumn(string $columnName) : stringTransform a column name from the user-specified form to the physical form used in the database.
Inherited from: \Zend_Db_Table_Row_Abstract::_transformColumn()You can override this method in a custom Row class to implement column name mappings, for example inflection.
| Name | Type | Description |
|---|---|---|
| $columnName | string | Column name given. |
| Type | Description |
|---|---|
| string | The column name after transformation applied (none by default). |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception | if the $columnName is not a string. |

_update() : voidAllows pre-update logic to be applied to row.
Inherited from: \Zend_Db_Table_Row_Abstract::_update()Subclasses may override this method.

findDependentRowset(string | \Zend_Db_Table_Abstract $dependentTable, string $ruleKey = null, \Zend_Db_Table_Select $select = null) : \Zend_Db_Table_Rowset_AbstractQuery a dependent table to retrieve rows matching the current row.
Inherited from: \Zend_Db_Table_Row_Abstract::findDependentRowset()| Name | Type | Description |
|---|---|---|
| $dependentTable | string | \Zend_Db_Table_Abstract | |
| $ruleKey | string | OPTIONAL $ruleKey |
| $select | \Zend_Db_Table_Select | OPTIONAL $select |
| Type | Description |
|---|---|
| \Zend_Db_Table_Rowset_Abstract | Query result from $dependentTable |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception | If $dependentTable is not a table or is not loadable. |

findManyToManyRowset(string | \Zend_Db_Table_Abstract $matchTable, string | \Zend_Db_Table_Abstract $intersectionTable, string $callerRefRule = null, string $matchRefRule = null, \Zend_Db_Table_Select $select = null) : \Zend_Db_Table_Rowset_Abstract| Name | Type | Description |
|---|---|---|
| $matchTable | string | \Zend_Db_Table_Abstract | |
| $intersectionTable | string | \Zend_Db_Table_Abstract | |
| $callerRefRule | string | OPTIONAL $callerRefRule |
| $matchRefRule | string | OPTIONAL $matchRefRule |
| $select | \Zend_Db_Table_Select | OPTIONAL $select |
| Type | Description |
|---|---|
| \Zend_Db_Table_Rowset_Abstract | Query result from $matchTable |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception | If $matchTable or $intersectionTable is not a table class or is not loadable. |

findParentRow(string | \Zend_Db_Table_Abstract $parentTable, string $ruleKey = null, \Zend_Db_Table_Select $select = null) : \Zend_Db_Table_Row_AbstractQuery a parent table to retrieve the single row matching the current row.
Inherited from: \Zend_Db_Table_Row_Abstract::findParentRow()| Name | Type | Description |
|---|---|---|
| $parentTable | string | \Zend_Db_Table_Abstract | |
| $ruleKey | string | OPTIONAL $ruleKey |
| $select | \Zend_Db_Table_Select | OPTIONAL $select |
| Type | Description |
|---|---|
| \Zend_Db_Table_Row_Abstract | Query result from $parentTable |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception | If $parentTable is not a table or is not loadable. |

getPrimaryKey(bool $useDirty = true) : arrayRetrieves an associative array of primary keys.
Inherited from: \Zend_Db_Table_Row_Abstract::getPrimaryKey()| Name | Type | Description |
|---|---|---|
| $useDirty | bool |
| Type | Description |
|---|---|
| array |

getTable() : \Zend_Db_Table_Abstract | nullReturns the table object, or null if this is disconnected row
Inherited from: \Zend_Db_Table_Row_Abstract::getTable()| Type | Description |
|---|---|
| \Zend_Db_Table_Abstract | null |

getTableClass() : stringQuery the class name of the Table object for which this Row was created.
Inherited from: \Zend_Db_Table_Row_Abstract::getTableClass()| Type | Description |
|---|---|
| string |

isConnected() : booleanTest the connected status of the row.
Inherited from: \Zend_Db_Table_Row_Abstract::isConnected()| Type | Description |
|---|---|
| boolean |

isReadOnly() : booleanTest the read-only status of the row.
Inherited from: \Zend_Db_Table_Row_Abstract::isReadOnly()| Type | Description |
|---|---|
| boolean |

offsetExists(string $offset) : booleanProxy to __isset Required by the ArrayAccess implementation
Inherited from: \Zend_Db_Table_Row_Abstract::offsetExists()| Name | Type | Description |
|---|---|---|
| $offset | string |
| Type | Description |
|---|---|
| boolean |

offsetGet(string $offset) : stringProxy to __get Required by the ArrayAccess implementation
Inherited from: \Zend_Db_Table_Row_Abstract::offsetGet()| Name | Type | Description |
|---|---|---|
| $offset | string |
| Type | Description |
|---|---|
| string |

offsetSet(string $offset, mixed $value) : voidProxy to __set Required by the ArrayAccess implementation
Inherited from: \Zend_Db_Table_Row_Abstract::offsetSet()| Name | Type | Description |
|---|---|---|
| $offset | string | |
| $value | mixed |

offsetUnset(string $offset) : voidProxy to __unset Required by the ArrayAccess implementation
Inherited from: \Zend_Db_Table_Row_Abstract::offsetUnset()| Name | Type | Description |
|---|---|---|
| $offset | string |

refresh() : voidRefreshes properties from the database.
Inherited from: \Zend_Db_Table_Row_Abstract::refresh()
save() : mixed
This performs an intelligent insert/update, and reloads the properties with fresh data from the table on success.
| Type | Description |
|---|---|
| mixed | The primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column. |

select() : \Zend_Db_Table_SelectReturns an instance of the parent table's Zend_Db_Table_Select object.
Inherited from: \Zend_Db_Table_Row_Abstract::select()| Type | Description |
|---|---|
| \Zend_Db_Table_Select |

setFromArray(array $data) : \Zend_Db_Table_Row_AbstractSets all data in the row from an array.
Inherited from: \Zend_Db_Table_Row_Abstract::setFromArray()| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| \Zend_Db_Table_Row_Abstract | Provides a fluent interface |

setReadOnly(boolean $flag) : booleanSet the read-only status of the row.
Inherited from: \Zend_Db_Table_Row_Abstract::setReadOnly()| Name | Type | Description |
|---|---|---|
| $flag | boolean |
| Type | Description |
|---|---|
| boolean |

setTable(\Zend_Db_Table_Abstract $table = null) : booleanSet the table object, to re-establish a live connection to the database for a Row that has been de-serialized.
Inherited from: \Zend_Db_Table_Row_Abstract::setTable()| Name | Type | Description |
|---|---|---|
| $table | \Zend_Db_Table_Abstract |
| Type | Description |
|---|---|
| boolean |
| Exception | Description |
|---|---|
| \Zend_Db_Table_Row_Exception |

toArray() : arrayReturns the column/value data as an array.
Inherited from: \Zend_Db_Table_Row_Abstract::toArray()| Type | Description |
|---|---|
| array |