Public Member Functions | |
__construct (array $config=array()) | |
__get ($columnName) | |
__set ($columnName, $value) | |
__unset ($columnName) | |
__isset ($columnName) | |
__sleep () | |
__wakeup () | |
offsetExists ($offset) | |
offsetGet ($offset) | |
offsetSet ($offset, $value) | |
offsetUnset ($offset) | |
init () | |
getTable () | |
setTable (Zend_Db_Table_Abstract $table=null) | |
getTableClass () | |
isConnected () | |
isReadOnly () | |
setReadOnly ($flag) | |
select () | |
save () | |
delete () | |
toArray () | |
setFromArray (array $data) | |
refresh () | |
findDependentRowset ($dependentTable, $ruleKey=null, Zend_Db_Table_Select $select=null) | |
findParentRow ($parentTable, $ruleKey=null, Zend_Db_Table_Select $select=null) | |
findManyToManyRowset ($matchTable, $intersectionTable, $callerRefRule=null, $matchRefRule=null, Zend_Db_Table_Select $select=null) | |
__call ($method, array $args) | |
Protected Member Functions | |
_transformColumn ($columnName) | |
_doInsert () | |
_doUpdate () | |
_getTable () | |
_getPrimaryKey ($useDirty=true) | |
_getWhereQuery ($useDirty=true) | |
_refresh () | |
_insert () | |
_postInsert () | |
_update () | |
_postUpdate () | |
_delete () | |
_postDelete () | |
_prepareReference (Zend_Db_Table_Abstract $dependentTable, Zend_Db_Table_Abstract $parentTable, $ruleKey) | |
_getTableFromString ($tableName) | |
Protected Attributes | |
$_data = array() | |
$_cleanData = array() | |
$_modifiedFields = array() | |
$_table = null | |
$_connected = true | |
$_readOnly = false | |
$_tableClass = null | |
$_primary |
Definition at line 35 of file Abstract.php.
__construct | ( | array $ | config = array() ) |
Constructor.
Supported params for $config are:-
array | $config | OPTIONAL Array of user-specified config options. |
Zend_Db_Table_Row_Exception |
Definition at line 114 of file Abstract.php.
__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. +?
Definition at line 1102 of file Abstract.php.
__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. |
Definition at line 174 of file Abstract.php.
__isset | ( | $ | columnName ) |
Test existence of row field
string | $columnName | The column key. |
Definition at line 231 of file Abstract.php.
__set | ( | $ | columnName, |
$ | value | ||
) |
Set row field value
string | $columnName | The column key. |
mixed | $value | The value for the property. |
Zend_Db_Table_Row_Exception |
Definition at line 192 of file Abstract.php.
__sleep | ( | ) |
Store table, primary key and data in serialized object
Definition at line 242 of file Abstract.php.
__unset | ( | $ | columnName ) |
Unset row field value
string | $columnName | The column key. |
Zend_Db_Table_Row_Exception |
Definition at line 210 of file Abstract.php.
__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.
Definition at line 254 of file Abstract.php.
_delete | ( | ) | [protected] |
Allows pre-delete logic to be applied to row. Subclasses may override this method.
Definition at line 812 of file Abstract.php.
_doInsert | ( | ) | [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.
Definition at line 447 of file Abstract.php.
_doUpdate | ( | ) | [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.
Definition at line 505 of file Abstract.php.
_getPrimaryKey | ( | $ | useDirty = true ) |
[protected] |
Retrieves an associative array of primary keys.
bool | $useDirty |
Definition at line 701 of file Abstract.php.
_getTable | ( | ) | [protected] |
Retrieves an instance of the parent table.
Definition at line 686 of file Abstract.php.
_getTableFromString | ( | $ | tableName ) | [protected] |
_getTableFromString
string | $tableName |
Definition at line 1162 of file Abstract.php.
_getWhereQuery | ( | $ | useDirty = true ) |
[protected] |
Constructs where statement for retrieving row(s).
bool | $useDirty |
Definition at line 727 of file Abstract.php.
_insert | ( | ) | [protected] |
Allows pre-insert logic to be applied to row. Subclasses may override this method.
Definition at line 772 of file Abstract.php.
_postDelete | ( | ) | [protected] |
Allows post-delete logic to be applied to row. Subclasses may override this method.
Definition at line 822 of file Abstract.php.
_postInsert | ( | ) | [protected] |
Allows post-insert logic to be applied to row. Subclasses may override this method.
Definition at line 782 of file Abstract.php.
_postUpdate | ( | ) | [protected] |
Allows post-update logic to be applied to row. Subclasses may override this method.
Definition at line 802 of file Abstract.php.
_prepareReference | ( | Zend_Db_Table_Abstract $ | dependentTable, |
Zend_Db_Table_Abstract $ | parentTable, | ||
$ | ruleKey | ||
) | [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 |
Definition at line 836 of file Abstract.php.
_refresh | ( | ) | [protected] |
_transformColumn | ( | $ | columnName ) | [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. |
Definition at line 157 of file Abstract.php.
_update | ( | ) | [protected] |
Allows pre-update logic to be applied to row. Subclasses may override this method.
Definition at line 792 of file Abstract.php.
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
Definition at line 594 of file Abstract.php.
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. |
Definition at line 861 of file Abstract.php.
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. |
Definition at line 984 of file Abstract.php.
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. |
Definition at line 917 of file Abstract.php.
getTable | ( | ) |
Returns the table object, or null if this is disconnected row
Definition at line 321 of file Abstract.php.
getTableClass | ( | ) |
Query the class name of the Table object for which this Row was created.
Definition at line 374 of file Abstract.php.
init | ( | ) |
Initialize object
Called from __construct() as final step of object instantiation.
Definition at line 312 of file Abstract.php.
isConnected | ( | ) |
isReadOnly | ( | ) |
offsetExists | ( | $ | offset ) |
Proxy to __isset Required by the ArrayAccess implementation
string | $offset |
Definition at line 266 of file Abstract.php.
offsetGet | ( | $ | offset ) |
Proxy to __get Required by the ArrayAccess implementation
string | $offset |
Definition at line 278 of file Abstract.php.
offsetSet | ( | $ | offset, |
$ | value | ||
) |
Proxy to __set Required by the ArrayAccess implementation
string | $offset | |
mixed | $value |
Definition at line 290 of file Abstract.php.
offsetUnset | ( | $ | offset ) |
Does nothing Required by the ArrayAccess implementation
string | $offset |
Definition at line 301 of file Abstract.php.
refresh | ( | ) |
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.
Definition at line 429 of file Abstract.php.
select | ( | ) |
Returns an instance of the parent table's Zend_Db_Table_Select object.
Definition at line 415 of file Abstract.php.
setFromArray | ( | array $ | data ) |
Sets all data in the row from an array.
array | $data |
Definition at line 660 of file Abstract.php.
setReadOnly | ( | $ | flag ) |
Set the read-only status of the row.
boolean | $flag |
Definition at line 405 of file Abstract.php.
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 |
Definition at line 334 of file Abstract.php.
toArray | ( | ) |
Returns the column/value data as an array.
Definition at line 649 of file Abstract.php.