API Documentation

Zend/Db/Table/Row/Abstract.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Db  
Subpackage
Table  
Version
$Id: Abstract.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Db_Table_Row_Abstract

Package: Zend\Db\Table

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

Propertyprotectedarray  $_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
Propertyprotectedboolean  $_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
Propertyprotectedarray  $_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
Propertyprotectedarray  $_modifiedFields= 'array()'

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

Default valuearray()Details
Type
array
Propertyprotectedarray  $_primary= ''

Primary row key(s).

Details
Type
array
Propertyprotectedboolean  $_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
Propertyprotected\Zend_Db_Table_Abstract  $_table= 'null'

Zend_Db_Table_Abstract parent class or instance.

Default valuenullDetails
Type
\Zend_Db_Table_Abstract
Propertyprotectedstring  $_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
Name Type Description
$method string
$args array

OPTIONAL Zend_Db_Table_Select query modifier

Returns
Type Description
\Zend_Db_Table_Row_Abstract|\Zend_Db_Table_Rowset_Abstract
Throws
Exception Description
\Zend_Db_Table_Row_Exception If 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
Name Type Description
$config array

OPTIONAL Array of user-specified config options.

Throws
Exception Description
\Zend_Db_Table_Row_Exception
methodpublic__get( string $columnName ) : string

Retrieve row field value

Parameters
Name Type Description
$columnName string

The user-specified column name.

Returns
Type Description
string The corresponding column value.
Throws
Exception Description
\Zend_Db_Table_Row_Exception if the $columnName is not a column in the row.
methodpublic__isset( string $columnName ) : boolean

Test existence of row field

Parameters
Name Type Description
$columnName string

The column key.

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

Set row field value

Parameters
Name Type Description
$columnName string

The column key.

$value mixed

The value for the property.

Throws
Exception Description
\Zend_Db_Table_Row_Exception
methodpublic__sleep( ) : array

Store table, primary key and data in serialized object

Returns
Type Description
array
methodpublic__unset( string $columnName ) : \Zend_Db_Table_Row_Abstract

Unset row field value

Parameters
Name Type Description
$columnName string

The column key.

Returns
Type Description
\Zend_Db_Table_Row_Abstract
Throws
Exception Description
\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
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.
methodprotected_doUpdate( ) : mixed

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.
methodprotected_getPrimaryKey( bool $useDirty = true ) : array

Retrieves an associative array of primary keys.

Parameters
Name Type Description
$useDirty bool
Returns
Type Description
array
methodprotected_getTable( ) : \Zend_Db_Table_Abstract

Retrieves an instance of the parent table.

Returns
Type Description
\Zend_Db_Table_Abstract
methodprotected_getTableFromString( string $tableName ) : \Zend_Db_Table_Abstract

_getTableFromString

Parameters
Name Type Description
$tableName string
Returns
Type Description
\Zend_Db_Table_Abstract
methodprotected_getWhereQuery( bool $useDirty = true ) : array

Constructs where statement for retrieving row(s).

Parameters
Name Type Description
$useDirty bool
Returns
Type Description
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
Name Type Description
$dependentTable \Zend_Db_Table_Abstract
$parentTable \Zend_Db_Table_Abstract
$ruleKey string
Returns
Type Description
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
Name Type Description
$columnName string

Column name given.

Returns
Type Description
string The column name after transformation applied (none by default).
Throws
Exception Description
\Zend_Db_Table_Row_Exception if 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
Type Description
int The number of rows deleted.
methodpublicfindDependentRowset( 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.

Parameters
Name Type Description
$dependentTable string|\Zend_Db_Table_Abstract
$ruleKey string

OPTIONAL $ruleKey

$select \Zend_Db_Table_Select

OPTIONAL $select

Returns
Type Description
\Zend_Db_Table_Rowset_Abstract Query result from $dependentTable
Throws
Exception Description
\Zend_Db_Table_Row_Exception If $dependentTable is not a table or is not loadable.
methodpublicfindManyToManyRowset( 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

Parameters
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

Returns
Type Description
\Zend_Db_Table_Rowset_Abstract Query result from $matchTable
Throws
Exception Description
\Zend_Db_Table_Row_Exception If $matchTable or $intersectionTable is not a table class or is not loadable.
methodpublicfindParentRow( 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.

Parameters
Name Type Description
$parentTable string|\Zend_Db_Table_Abstract
$ruleKey string

OPTIONAL $ruleKey

$select \Zend_Db_Table_Select

OPTIONAL $select

Returns
Type Description
\Zend_Db_Table_Row_Abstract Query result from $parentTable
Throws
Exception Description
\Zend_Db_Table_Row_Exception If $parentTable is not a table or is not loadable.
methodpublicgetIterator( ) : void

methodpublicgetTable( ) : \Zend_Db_Table_Abstract|null

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

Returns
Type Description
\Zend_Db_Table_Abstract|null
methodpublicgetTableClass( ) : string

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

Returns
Type Description
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
Type Description
boolean
methodpublicisReadOnly( ) : boolean

Test the read-only status of the row.

Returns
Type Description
boolean
methodpublicoffsetExists( string $offset ) : boolean

Proxy to __isset Required by the ArrayAccess implementation

Parameters
Name Type Description
$offset string
Returns
Type Description
boolean
methodpublicoffsetGet( string $offset ) : string

Proxy to __get Required by the ArrayAccess implementation

Parameters
Name Type Description
$offset string
Returns
Type Description
string
methodpublicoffsetSet( string $offset, mixed $value ) : void

Proxy to __set Required by the ArrayAccess implementation

Parameters
Name Type Description
$offset string
$value mixed
methodpublicoffsetUnset( string $offset ) : void

Proxy to __unset Required by the ArrayAccess implementation

Parameters
Name Type Description
$offset string
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
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.
methodpublicselect( ) : \Zend_Db_Table_Select

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

Returns
Type Description
\Zend_Db_Table_Select
methodpublicsetFromArray( array $data ) : \Zend_Db_Table_Row_Abstract

Sets all data in the row from an array.

Parameters
Name Type Description
$data array
Returns
Type Description
\Zend_Db_Table_Row_Abstract Provides a fluent interface
methodpublicsetReadOnly( boolean $flag ) : boolean

Set the read-only status of the row.

Parameters
Name Type Description
$flag boolean
Returns
Type Description
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
Name Type Description
$table \Zend_Db_Table_Abstract
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Db_Table_Row_Exception
methodpublictoArray( ) : array

Returns the column/value data as an array.

Returns
Type Description
array
Documentation was generated by DocBlox 0.15.1.