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 [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: Abstract.php 24831 2012-05-30 12:52:25Z rob $
\Zend_Db_Table_Row_Abstract
- Implements
- Children
- \Zend_Db_Table_Row
- 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().
array()
Details- Type
- array


boolean $_connected = true
Connected is true if we have a reference to a live Zend_Db_Table_Abstract object.
This is false after the Rowset has been deserialized.
true
Details- 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.
array()
Details- Type
- array


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


boolean $_readOnly = false
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.
false
Details- Type
- boolean


\Zend_Db_Table_Abstract $_table = null
Zend_Db_Table_Abstract parent class or instance.
null
Details
Methods


__call(string $method, array $args) : \Zend_Db_Table_Row_Abstract | \Zend_Db_Table_Rowset_Abstract
Turn magic function calls into non-magic function calls to the above methods.
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
Constructor.
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
Retrieve row field value
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
Test existence of row field
Name | Type | Description |
---|---|---|
$columnName | string | The column key. |
Type | Description |
---|---|
boolean |


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


__sleep() : array
Store table, primary key and data in serialized object
Type | Description |
---|---|
array |


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


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


_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) : array
Retrieves an associative array of primary keys.
Name | Type | Description |
---|---|---|
$useDirty | bool |
Type | Description |
---|---|
array |


_getTable() : \Zend_Db_Table_Abstract
Retrieves an instance of the parent table.
Type | Description |
---|---|
\Zend_Db_Table_Abstract |


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


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


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


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


_postUpdate() : void
Allows 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) : array
Prepares a table reference for lookup.
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 |


_transformColumn(string $columnName) : string
Transform 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.
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. |


findDependentRowset(string | \Zend_Db_Table_Abstract $dependentTable, string $ruleKey = null, \Zend_Db_Table_Select $select = null) : \Zend_Db_Table_Rowset_Abstract
Query a dependent table to retrieve rows matching the current row.
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_Abstract
Query a parent table to retrieve the single row matching the current row.
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) : array
Retrieves an associative array of primary keys.
Name | Type | Description |
---|---|---|
$useDirty | bool |
Type | Description |
---|---|
array |


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


getTableClass() : string
Query the class name of the Table object for which this Row was created.
Type | Description |
---|---|
string |


offsetExists(string $offset) : boolean
Proxy to __isset Required by the ArrayAccess implementation
Name | Type | Description |
---|---|---|
$offset | string |
Type | Description |
---|---|
boolean |


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


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


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


save() : mixed
Saves the properties to the database.
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_Select
Returns an instance of the parent table's Zend_Db_Table_Select object.
Type | Description |
---|---|
\Zend_Db_Table_Select |


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


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


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