Db/Table/Row/Abstract.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 license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Db
- Subpackage
- Table
- Version
- $Id$
\Zend_Db_Table_Row_Abstract
Package: Zend_Db\Table- Implements
- Children
- \Zend_Db_Table_Row
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 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().
Default valuearray()Details- Type
- array



boolean $_connected = trueConnected is true if we have a reference to a live
Zend_Db_Table_Abstract object.
This is false after the Rowset has been deserialized.
Default valuetrueDetails- Type
- boolean



array $_data = array()The data for each column in the row (column_name => value).
The keys must match the physical names of columns in the
table for which this row is defined.
Default valuearray()Details- Type
- array



array $_modifiedFields = array()Tracks columns where data has been updated. Allows more specific insert and
update operations.
Default valuearray()Details- Type
- array



boolean $_readOnly = falseA 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.
Default valuefalseDetails- Type
- boolean



string $_tableClass = nullName of the class of the Zend_Db_Table_Abstract object.
Default valuenullDetails- Type
- string
Methods



__construct(array $config = array()) : voidSupported params for $config are:-
- table = class name or object of type Zend_Db_Table_Abstract
- data = values of columns in this row.
Parameters| Name | Type | Description |
|---|
| $config | array | OPTIONAL Array of user-specified config options. |
|---|
Throws


__get(string $columnName) : stringParameters| Name | Type | Description |
|---|
| $columnName | string | The user-specified column name. |
|---|
Returns| Type | Description |
|---|
| string | The corresponding column value. |
Throws 


__isset(string $columnName) : booleanTest existence of row field
Parameters| Name | Type | Description |
|---|
| $columnName | string | The column key. |
|---|
Returns 


__set(string $columnName, mixed $value) : voidParameters| Name | Type | Description |
|---|
| $columnName | string | The column key. |
|---|
| $value | mixed | The value for the property. |
|---|
Throws 


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



_getPrimaryKey(bool $useDirty = true) : arrayRetrieves an associative array of primary keys.
Parameters| Name | Type | Description |
|---|
| $useDirty | bool | |
|---|
Returns 


_getWhereQuery(bool $useDirty = true) : arrayConstructs where statement for retrieving row(s).
Parameters| Name | Type | Description |
|---|
| $useDirty | bool | |
|---|
Returns 


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



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



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



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



_prepareReference(\Zend_Db_Table_Abstract $dependentTable, \Zend_Db_Table_Abstract $parentTable, string $ruleKey) : arrayPrepares a table reference for lookup.
Ensures all reference keys are set and properly formatted.
ParametersReturns


_transformColumn(string $columnName) : stringTransform a column name from the user-specified form
to the physical form used in the database.
You can override this method in a custom Row class
to implement column name mappings, for example inflection.
Parameters| Name | Type | Description |
|---|
| $columnName | string | Column name given. |
|---|
Returns| Type | Description |
|---|
| string | The column name after transformation applied (none by default). |
Throws


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



getPrimaryKey(bool $useDirty = true) : arrayRetrieves an associative array of primary keys.
Parameters| Name | Type | Description |
|---|
| $useDirty | bool | |
|---|
Returns 


offsetExists(string $offset) : booleanProxy to __isset
Required by the ArrayAccess implementation
Parameters| Name | Type | Description |
|---|
| $offset | string | |
|---|
Returns 


offsetGet(string $offset) : stringProxy to __get
Required by the ArrayAccess implementation
Parameters| Name | Type | Description |
|---|
| $offset | string | |
|---|
Returns 


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



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



save() : mixedSaves the properties to the database.
This performs an intelligent insert/update, and reloads the
properties with fresh data from the table on success.
Returns| 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. |



setFromArray(array $data) : \Zend_Db_Table_Row_AbstractSets all data in the row from an array.
Parameters| Name | Type | Description |
|---|
| $data | array | |
|---|
Returns 


setReadOnly(boolean $flag) : booleanSet the read-only status of the row.
Parameters| Name | Type | Description |
|---|
| $flag | boolean | |
|---|
Returns