Db/Table/Row/Abstract.php

Show: PublicProtectedPrivateinherited
Table of Contents
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

>VPropertyprotectedarray $_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
>VPropertyprotectedboolean $_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.
Default valuetrueDetails
Type
boolean
>VPropertyprotectedarray $_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
>VPropertyprotectedarray $_modifiedFields = array()
Tracks columns where data has been updated. Allows more specific insert and update operations.
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_primary
Primary row key(s).
Details
Type
array
>VPropertyprotectedboolean $_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.
Default valuefalseDetails
Type
boolean
>VPropertyprotected\Zend_Db_Table_Abstract $_table = null
Zend_Db_Table_Abstract parent class or instance.
Default valuenullDetails
Type
\Zend_Db_Table_Abstract
>VPropertyprotectedstring $_tableClass = null
Name of the class of the Zend_Db_Table_Abstract object.
Default valuenullDetails
Type
string

Methods

methodpublic__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.

Parameters
NameTypeDescription
$methodstring
$argsarray

OPTIONAL Zend_Db_Table_Select query modifier

Returns
TypeDescription
\Zend_Db_Table_Row_Abstract | \Zend_Db_Table_Rowset_Abstract
Throws
ExceptionDescription
\Zend_Db_Table_Row_ExceptionIf an invalid method is called.
methodpublic__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.
Parameters
NameTypeDescription
$configarray

OPTIONAL Array of user-specified config options.

Throws
ExceptionDescription
\Zend_Db_Table_Row_Exception
methodpublic__get(string $columnName) : string

Retrieve row field value

Parameters
NameTypeDescription
$columnNamestring

The user-specified column name.

Returns
TypeDescription
stringThe corresponding column value.
Throws
ExceptionDescription
\Zend_Db_Table_Row_Exceptionif the $columnName is not a column in the row.
methodpublic__isset(string $columnName) : boolean

Test existence of row field

Parameters
NameTypeDescription
$columnNamestring

The column key.

Returns
TypeDescription
boolean
methodpublic__set(string $columnName, mixed $value) : void

Set row field value

Parameters
NameTypeDescription
$columnNamestring

The column key.

$valuemixed

The value for the property.

Throws
ExceptionDescription
\Zend_Db_Table_Row_Exception
methodpublic__sleep() : array

Store table, primary key and data in serialized object

Returns
TypeDescription
array
methodpublic__unset(string $columnName) : \Zend_Db_Table_Row_Abstract

Unset row field value

Parameters
NameTypeDescription
$columnNamestring

The column key.

Returns
TypeDescription
\Zend_Db_Table_Row_Abstract
Throws
ExceptionDescription
\Zend_Db_Table_Row_Exception
methodpublic__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.
methodprotected_delete() : void

Allows pre-delete logic to be applied to row.

Subclasses may override this method.
methodprotected_doInsert() : mixed

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

Returns
TypeDescription
mixedThe primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column.
methodprotected_getPrimaryKey(bool $useDirty = true) : array

Retrieves an associative array of primary keys.

Parameters
NameTypeDescription
$useDirtybool
Returns
TypeDescription
array
methodprotected_getTable() : \Zend_Db_Table_Abstract

Retrieves an instance of the parent table.

Returns
TypeDescription
\Zend_Db_Table_Abstract
methodprotected_getTableFromString(string $tableName) : \Zend_Db_Table_Abstract

_getTableFromString

Parameters
NameTypeDescription
$tableNamestring
Returns
TypeDescription
\Zend_Db_Table_Abstract
methodprotected_getWhereQuery(bool $useDirty = true) : array

Constructs where statement for retrieving row(s).

Parameters
NameTypeDescription
$useDirtybool
Returns
TypeDescription
array
methodprotected_insert() : void

Allows pre-insert logic to be applied to row.

Subclasses may override this method.
methodprotected_postDelete() : void

Allows post-delete logic to be applied to row.

Subclasses may override this method.
methodprotected_postInsert() : void

Allows post-insert logic to be applied to row.

Subclasses may override this method.
methodprotected_postUpdate() : void

Allows post-update logic to be applied to row.

Subclasses may override this method.
methodprotected_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.
Parameters
NameTypeDescription
$dependentTable\Zend_Db_Table_Abstract
$parentTable\Zend_Db_Table_Abstract
$ruleKeystring
Returns
TypeDescription
array
methodprotected_refresh() : void

Refreshes properties from the database.

methodprotected_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.
Parameters
NameTypeDescription
$columnNamestring

Column name given.

Returns
TypeDescription
stringThe column name after transformation applied (none by default).
Throws
ExceptionDescription
\Zend_Db_Table_Row_Exceptionif the $columnName is not a string.
methodprotected_update() : void

Allows pre-update logic to be applied to row.

Subclasses may override this method.
methodpublicdelete() : int

Deletes existing rows.

Returns
TypeDescription
intThe number of rows deleted.
methodpublicfindDependentRowset(string | \Zend_Db_Table_Abstract $dependentTable,  $ruleKey = null,  $select = null) : \Zend_Db_Table_Rowset_Abstract

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

Parameters
NameTypeDescription
$dependentTablestring | \Zend_Db_Table_Abstract
$ruleKey
$select
Returns
TypeDescription
\Zend_Db_Table_Rowset_AbstractQuery result from $dependentTable
Throws
ExceptionDescription
\Zend_Db_Table_Row_ExceptionIf $dependentTable is not a table or is not loadable.
methodpublicfindManyToManyRowset(string | \Zend_Db_Table_Abstract $matchTable, string | \Zend_Db_Table_Abstract $intersectionTable,  $callerRefRule = null,  $matchRefRule = null,  $select = null) : \Zend_Db_Table_Rowset_Abstract

Parameters
NameTypeDescription
$matchTablestring | \Zend_Db_Table_Abstract
$intersectionTablestring | \Zend_Db_Table_Abstract
$callerRefRule
$matchRefRule
$select
Returns
TypeDescription
\Zend_Db_Table_Rowset_AbstractQuery result from $matchTable
Throws
ExceptionDescription
\Zend_Db_Table_Row_ExceptionIf $matchTable or $intersectionTable is not a table class or is not loadable.
methodpublicfindParentRow(string | \Zend_Db_Table_Abstract $parentTable,  $ruleKey = null,  $select = null) : \Zend_Db_Table_Row_Abstract

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

Parameters
NameTypeDescription
$parentTablestring | \Zend_Db_Table_Abstract
$ruleKey
$select
Returns
TypeDescription
\Zend_Db_Table_Row_AbstractQuery result from $parentTable
Throws
ExceptionDescription
\Zend_Db_Table_Row_ExceptionIf $parentTable is not a table or is not loadable.
methodpublicgetIterator() : void

methodpublicgetPrimaryKey(bool $useDirty = true) : array

Retrieves an associative array of primary keys.

Parameters
NameTypeDescription
$useDirtybool
Returns
TypeDescription
array
methodpublicgetTable() : \Zend_Db_Table_Abstract | null

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

Returns
TypeDescription
\Zend_Db_Table_Abstract | null
methodpublicgetTableClass() : string

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

Returns
TypeDescription
string
methodpublicinit() : void

Initialize object

Called from {@link __construct()} as final step of object instantiation.
methodpublicisConnected() : boolean

Test the connected status of the row.

Returns
TypeDescription
boolean
methodpublicisReadOnly() : boolean

Test the read-only status of the row.

Returns
TypeDescription
boolean
methodpublicoffsetExists(string $offset) : boolean

Proxy to __isset Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetstring
Returns
TypeDescription
boolean
methodpublicoffsetGet(string $offset) : string

Proxy to __get Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetstring
Returns
TypeDescription
string
methodpublicoffsetSet(string $offset, mixed $value) : void

Proxy to __set Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetstring
$valuemixed
methodpublicoffsetUnset(string $offset) : void

Proxy to __unset Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetstring
methodpublicrefresh() : void

Refreshes properties from the database.

methodpublicsave() : 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.
Returns
TypeDescription
mixedThe primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column.
methodpublicselect() : \Zend_Db_Table_Select

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

Returns
TypeDescription
\Zend_Db_Table_Select
methodpublicsetFromArray(array $data) : \Zend_Db_Table_Row_Abstract

Sets all data in the row from an array.

Parameters
NameTypeDescription
$dataarray
Returns
TypeDescription
\Zend_Db_Table_Row_AbstractProvides a fluent interface
methodpublicsetReadOnly(boolean $flag) : boolean

Set the read-only status of the row.

Parameters
NameTypeDescription
$flagboolean
Returns
TypeDescription
boolean
methodpublicsetTable(\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.

Parameters
NameTypeDescription
$table\Zend_Db_Table_Abstract
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Db_Table_Row_Exception
methodpublictoArray() : array

Returns the column/value data as an array.

Returns
TypeDescription
array
Documentation was generated by phpDocumentor 2.2.0 .