Zend Framework
1.12
|
Public Member Functions | |
__construct (array $config=array()) | |
Constructor. | |
__get ($columnName) | |
Retrieve row field value. | |
__set ($columnName, $value) | |
Set row field value. | |
__unset ($columnName) | |
Unset row field value. | |
__isset ($columnName) | |
Test existence of row field. | |
__sleep () | |
Store table, primary key and data in serialized object. | |
__wakeup () | |
Setup to do on wakeup. | |
offsetExists ($offset) | |
Proxy to __isset Required by the ArrayAccess implementation. | |
offsetGet ($offset) | |
Proxy to __get Required by the ArrayAccess implementation. | |
offsetSet ($offset, $value) | |
Proxy to __set Required by the ArrayAccess implementation. | |
offsetUnset ($offset) | |
Proxy to __unset Required by the ArrayAccess implementation. | |
init () | |
Initialize object. | |
getTable () | |
Returns the table object, or null if this is disconnected row. | |
setTable (Zend_Db_Table_Abstract $table=null) | |
Set the table object, to re-establish a live connection to the database for a Row that has been de-serialized. | |
getTableClass () | |
Query the class name of the Table object for which this Row was created. | |
isConnected () | |
Test the connected status of the row. | |
isReadOnly () | |
Test the read-only status of the row. | |
setReadOnly ($flag) | |
Set the read-only status of the row. | |
select () | |
Returns an instance of the parent table's Zend_Db_Table_Select object. | |
save () | |
Saves the properties to the database. | |
delete () | |
Deletes existing rows. | |
getIterator () | |
toArray () | |
Returns the column/value data as an array. | |
setFromArray (array $data) | |
Sets all data in the row from an array. | |
refresh () | |
Refreshes properties from the database. | |
getPrimaryKey ($useDirty=true) | |
Retrieves an associative array of primary keys. | |
findDependentRowset ($dependentTable, $ruleKey=null, Zend_Db_Table_Select $select=null) | |
Query a dependent table to retrieve rows matching the current row. | |
findParentRow ($parentTable, $ruleKey=null, Zend_Db_Table_Select $select=null) | |
Query a parent table to retrieve the single row matching the current row. | |
findManyToManyRowset ($matchTable, $intersectionTable, $callerRefRule=null, $matchRefRule=null, Zend_Db_Table_Select $select=null) | |
__call ($method, array $args) | |
Turn magic function calls into non-magic function calls to the above methods. | |
Protected Member Functions | |
_transformColumn ($columnName) | |
Transform a column name from the user-specified form to the physical form used in the database. | |
_doInsert () | |
_doUpdate () | |
_getTable () | |
Retrieves an instance of the parent table. | |
_getPrimaryKey ($useDirty=true) | |
Retrieves an associative array of primary keys. | |
_getWhereQuery ($useDirty=true) | |
Constructs where statement for retrieving row(s). | |
_refresh () | |
Refreshes properties from the database. | |
_insert () | |
Allows pre-insert logic to be applied to row. | |
_postInsert () | |
Allows post-insert logic to be applied to row. | |
_update () | |
Allows pre-update logic to be applied to row. | |
_postUpdate () | |
Allows post-update logic to be applied to row. | |
_delete () | |
Allows pre-delete logic to be applied to row. | |
_postDelete () | |
Allows post-delete logic to be applied to row. | |
_prepareReference (Zend_Db_Table_Abstract $dependentTable, Zend_Db_Table_Abstract $parentTable, $ruleKey) | |
Prepares a table reference for lookup. | |
_getTableFromString ($tableName) | |
_getTableFromString | |
Protected Attributes | |
$_data = array() | |
$_cleanData = array() | |
$_modifiedFields = array() | |
$_table = null | |
$_connected = true | |
$_readOnly = false | |
$_tableClass = null | |
$_primary | |
__construct | ( | array | $config = array() | ) |
Constructor.
Supported params for $config are:-
array | $config | OPTIONAL Array of user-specified config options. |
Zend_Db_Table_Row_Exception |
__call | ( | $method, | |
array | $args | ||
) |
Turn magic function calls into non-magic function calls to the above methods.
string | $method | |
array | $args | OPTIONAL Zend_Db_Table_Select query modifier |
Zend_Db_Table_Row_Exception | If an invalid method is called. |
Recognize methods for Has-Many cases: findParent<Class>() findParent<Class>By<Rule>() Use the non-greedy pattern repeat modifier e.g. +?
Recognize methods for Many-to-Many cases: find<Class1>Via<Class2>() find<Class1>Via<Class2>By<Rule>() find<Class1>Via<Class2>By<Rule1>And<Rule2>() Use the non-greedy pattern repeat modifier e.g. +?
Recognize methods for Belongs-To cases: find<Class>() find<Class>By<Rule>() Use the non-greedy pattern repeat modifier e.g. +?
__get | ( | $columnName | ) |
Retrieve row field value.
string | $columnName | The user-specified column name. |
Zend_Db_Table_Row_Exception | if the $columnName is not a column in the row. |
__isset | ( | $columnName | ) |
Test existence of row field.
string | $columnName | The column key. |
__set | ( | $columnName, | |
$value | |||
) |
Set row field value.
string | $columnName | The column key. |
mixed | $value | The value for the property. |
Zend_Db_Table_Row_Exception |
__sleep | ( | ) |
Store table, primary key and data in serialized object.
__unset | ( | $columnName | ) |
Unset row field value.
string | $columnName | The column key. |
Zend_Db_Table_Row_Exception |
__wakeup | ( | ) |
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.
|
protected |
Allows pre-delete logic to be applied to row.
Subclasses may override this method.
|
protected |
A read-only row cannot be saved.
Run pre-INSERT logic
Execute the INSERT (this may throw an exception)
Normalize the result to an array indexed by primary key column(s). The table insert() method may return a scalar.
Save the new primary key value in _data. The primary key may have been generated by a sequence or auto-increment mechanism, and this merge should be done before the _postInsert() method is run, so the new values are available for logging, etc.
Run post-INSERT logic
Update the _cleanData to reflect that the data has been inserted.
|
protected |
A read-only row cannot be saved.
Get expressions for a WHERE clause based on the primary key value(s).
Run pre-UPDATE logic
Compare the data to the modified fields array to discover which columns have been changed.
Were any of the changed columns part of the primary key?
Execute cascading updates against dependent tables. Do this only if primary key value(s) were changed.
Execute the UPDATE (this may throw an exception) Do this only if data values were changed. Use the $diffData variable, so the UPDATE statement includes SET terms only for data values that changed.
Run post-UPDATE logic. Do this before the _refresh() so the _postUpdate() function can tell the difference between changed data and clean (pre-changed) data.
Refresh the data just in case triggers in the RDBMS changed any columns. Also this resets the _cleanData.
Return the primary key value(s) as an array if the key is compound or a scalar if the key is a scalar.
|
protected |
Retrieves an associative array of primary keys.
bool | $useDirty |
|
protected |
Retrieves an instance of the parent table.
|
protected |
|
protected |
Constructs where statement for retrieving row(s).
bool | $useDirty |
|
protected |
Allows pre-insert logic to be applied to row.
Subclasses may override this method.
|
protected |
Allows post-delete logic to be applied to row.
Subclasses may override this method.
|
protected |
Allows post-insert logic to be applied to row.
Subclasses may override this method.
|
protected |
Allows post-update logic to be applied to row.
Subclasses may override this method.
|
protected |
Prepares a table reference for lookup.
Ensures all reference keys are set and properly formatted.
Zend_Db_Table_Abstract | $dependentTable | |
Zend_Db_Table_Abstract | $parentTable | |
string | $ruleKey |
|
protected |
Refreshes properties from the database.
|
protected |
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.
string | $columnName | Column name given. |
Zend_Db_Table_Row_Exception | if the $columnName is not a string. |
|
protected |
Allows pre-update logic to be applied to row.
Subclasses may override this method.
delete | ( | ) |
Deletes existing rows.
A read-only row cannot be deleted.
Execute pre-DELETE logic
Execute cascading deletes against dependent tables
Execute the DELETE (this may throw an exception)
Execute post-DELETE logic
Reset all fields to null to indicate that the row is not there
findDependentRowset | ( | $dependentTable, | |
$ruleKey = null , |
|||
Zend_Db_Table_Select | $select = null |
||
) |
Query a dependent table to retrieve rows matching the current row.
string | Zend_Db_Table_Abstract | $dependentTable | |
string | OPTIONAL $ruleKey | |
Zend_Db_Table_Select | OPTIONAL $select |
Zend_Db_Table_Row_Exception | If $dependentTable is not a table or is not loadable. |
findManyToManyRowset | ( | $matchTable, | |
$intersectionTable, | |||
$callerRefRule = null , |
|||
$matchRefRule = null , |
|||
Zend_Db_Table_Select | $select = null |
||
) |
string | Zend_Db_Table_Abstract | $matchTable | |
string | Zend_Db_Table_Abstract | $intersectionTable | |
string | OPTIONAL $callerRefRule | |
string | OPTIONAL $matchRefRule | |
Zend_Db_Table_Select | OPTIONAL $select |
Zend_Db_Table_Row_Exception | If $matchTable or $intersectionTable is not a table class or is not loadable. |
findParentRow | ( | $parentTable, | |
$ruleKey = null , |
|||
Zend_Db_Table_Select | $select = null |
||
) |
Query a parent table to retrieve the single row matching the current row.
string | Zend_Db_Table_Abstract | $parentTable | |
string | OPTIONAL $ruleKey | |
Zend_Db_Table_Select | OPTIONAL $select |
Zend_Db_Table_Row_Exception | If $parentTable is not a table or is not loadable. |
getIterator | ( | ) |
getPrimaryKey | ( | $useDirty = true | ) |
Retrieves an associative array of primary keys.
bool | $useDirty |
getTable | ( | ) |
Returns the table object, or null if this is disconnected row.
getTableClass | ( | ) |
Query the class name of the Table object for which this Row was created.
init | ( | ) |
isConnected | ( | ) |
Test the connected status of the row.
isReadOnly | ( | ) |
Test the read-only status of the row.
offsetExists | ( | $offset | ) |
Proxy to __isset Required by the ArrayAccess implementation.
string | $offset |
offsetGet | ( | $offset | ) |
Proxy to __get Required by the ArrayAccess implementation.
string | $offset |
offsetSet | ( | $offset, | |
$value | |||
) |
Proxy to __set Required by the ArrayAccess implementation.
string | $offset | |
mixed | $value |
offsetUnset | ( | $offset | ) |
Proxy to __unset Required by the ArrayAccess implementation.
string | $offset |
refresh | ( | ) |
Refreshes properties from the database.
save | ( | ) |
Saves the properties to the database.
This performs an intelligent insert/update, and reloads the properties with fresh data from the table on success.
If the _cleanData array is empty, this is an INSERT of a new row. Otherwise it is an UPDATE.
select | ( | ) |
Returns an instance of the parent table's Zend_Db_Table_Select object.
setFromArray | ( | array | $data | ) |
Sets all data in the row from an array.
array | $data |
setReadOnly | ( | $flag | ) |
Set the read-only status of the row.
boolean | $flag |
setTable | ( | Zend_Db_Table_Abstract | $table = null | ) |
Set the table object, to re-establish a live connection to the database for a Row that has been de-serialized.
Zend_Db_Table_Abstract | $table |
Zend_Db_Table_Row_Exception |
toArray | ( | ) |
Returns the column/value data as an array.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |