Show:

Db_Row Class

Module: Db

This class lets you use Db rows and object-relational mapping functionality.

Your model classes should extend this class. For example, class User extends Db_Row.

When you extend this class, you can also implement the following callbacks. If they exist, Db_Row will call them at the appropriate time.

  • setUp Called by the constructor to set up the information for the fields and table relations.
  • beforeRetrieve($searchcriteria, $options) Called by retrieveOrSave() and retrieve() methods before retrieving a row. $search_criteria is an associative array of modified fields and their values. Return either an array of objects extending Db_Row, in which case no database SELECT is done, or return the $search_criteria to use for the database search. To totally cancel retrieval from the database, return null or an empty array. Typically, you would use this function to retrieve from a cache, and call calculatePKValue() to generate the key for the cache.
  • afterFetch($result) Called by retrieveOrSave(), retrieve() and $result->fetchDbRows() methods after retrieving a row. $result is the Db_Result, and $this is the Db_Row which was fetched
  • beforeGetRelated($relationName, $fields, $inputs, $options) Called by getRelated method before trying to get related rows. $relationName, $inputs and $fields are the parameters passed to getRelated. If return value is set, then that is what getRelated returns immediately after beforeGetRelated returns. Typically, you would use this function to retrieve from a cache.
  • beforeGetRelatedExecute($relationName, $query, $options) Called by getRelated() method before executing the Db_Query to get related rows. It is passed the $relationName, the $query, and any options passed to getRelated(). This function should return the Db_Query to execute.
  • beforeSave($modifiedFields) Called by save() method before saving the row. $modified_values is an associative array of modified fields and their values. Return the fields that should still be saved after beforeSave returns. To cancel saving into the database, return null or an empty array. If you've already run the query to save this row, return the query. Typically, you would use this function to save into a cache, and call calculatePKValue() to generate the key for the cache.
  • beforeSaveExecute($query, $where) Called by save() method before executing the Db_Query to save. It is passed the $query. This function should return the Db_Query to execute. $where is an array if this is an update query, otherwise it is null.
  • afterSaveExecute($result, $query, $modifiedFields, $where) Called by save() method after executing the Db_Query to save. It is passed the $result. This function can analyze the result & take further action. It should return the $result back to the caller. $where is an array if this is an update query, otherwise it is null.
  • beforeRemove($pk) Called by remove() method before saving the row. $pk is an associative array representing the primary key of the row to delete. Return a boolean indicating whether or not to delete.
  • beforeRemoveExecute($query) Called by remove() method before executing the Db_Query to save. It is passed the $query. This function should return the Db_Query to execute.
  • afterRemoveExecute($result, $query) Called by remove() method after executing the Db_Query to save. It is passed the $result and $query. This function can analyze the result & take further action. It should return the $result back to the caller.
  • beforeSet$name($value) Called before the field named $name is set. (Any illegal characters for function names are replaced with underscores) Return array($internalname, $value) of the field. Handy when changing the name of the field inside the database layer, as well as validating the value, etc.
  • afterSet$name($value) Called after the field named $name has been set. (Any illegal characters for function names are replaced with underscores)
  • afterSet($name, $value) Called after any field has been set, and after specific afterSet$name was called. Usually used to call things like notModified($name);
  • beforeGet$name() Called right before returning the name of the field called $name. If it's defined, whatever this function returns, the user receives. There is no real need for beforeGet($name) as a counterpart to beforeSet($name, $value), as there is no need to change the $name. You can obtain the value of the field, and return it.
  • isset$name Called when checking if the field called $name is set and not null. Return true or false. Your function should probably make use of $this->fields directly here.
  • unset$name Called when someone wants to unset the field called $name. Your function should probably make use of $this->fields directly here.

Constructor

Db_Row

(
  • [$fields=array()]
  • [$doInit=true]
)

Parameters:

  • [$fields=array()] Array optional

    Here you can provide any fields to set on the row right away.

  • [$doInit=true] Boolean optional

    Whether to initialize the row. The reason this is here is that passing object arguments to the constructor by using PDOStatement::setFetchMode() causes a memory leak. This is only set to false by Db_Result::fetchDbRows(), which subsequently calls init() by itself. As a user of this class, don't override this default value.

Methods

__call

(
  • $name
  • $args
)
Mixed

Extra shortcuts when calling methods

Parameters:

  • $name String
  • $args Array

Returns:

Mixed:

__get

(
  • $name
)
Mixed

Gets a column in the row

Parameters:

  • $name String

Returns:

Mixed:

__isset

(
  • $name
)
Mixed

Returns whether a column in the row is set

Parameters:

  • $name String

Returns:

Mixed:

__set

(
  • $name
  • $value
)

Sets a column in the row

Parameters:

  • $name String
  • $value Mixed

__set_state

(
  • $array
)

Implements __set_state method, so it can be exported

Parameters:

  • $array Array

__toMarkup

() String

Dumps the result as an HTML table.

Returns:

String:

__toString

()

Dumps the result as a table in text mode

__unset

(
  • $name
)

Unsets a column in the row. This only affects the PHP object, not the database record. If the PHP object is saved, it simply does not affect that column in the database.

Parameters:

  • $name String

calculatePKValue

() Array | False

Calculate the primary key's value for this record Different from getPKValue in that it returns the CURRENT values of all the fields named in the primary key index. This can be called even if the Db_Row was not retrieved, and typically is used for caching purposes.

Returns:

Array | False:

An associative array naming all the fields that comprise the primary key index, in the order they appear in the key.
Returns false if even one of the fields comprising the primary key is not set.

clear

(
  • $key1
  • $key2
)

Clears the value of a field, possibly deep inside the array

Parameters:

  • $key1 String

    The name of the first key in the configuration path

  • $key2 String

    Optional. The name of the second key in the configuration path. You can actually pass as many keys as you need, delving deeper and deeper into the configuration structure. All but the second-to-last parameter are interpreted as keys.

copyFrom

(
  • $source
  • [$stripPrefix=null]
  • [$suppressHooks=false]
  • [$markModified=true]
)
Db_Row

This function copies the members of an array or something supporting "Enumerable".

Parameters:

  • $source Mixed

    The source of the parameters. Typically the output of Db_Utils::take, unleashed on $_POST or $_REQUEST or something like that. Just used for convenience.

  • [$stripPrefix=null] String optional

    If not empty, only copies the elements with the prefix, stripping it out. Useful for assigning values whose names were prefixed with namespaces.

  • [$suppressHooks=false] Boolean optional

    If true, assigns everything but does not fire the beforeSet and afterSet events.

  • [$markModified=true] Boolean optional

    Defaults to true. Whether to mark the affected fields as modified or not.

Returns:

Db_Row:

returns this object, for chaining

copyFromRow

(
  • $row
  • [$stripPrefix=null]
  • [$suppressHooks=false]
  • [$markModified=null]
)
Db_Row

This function copies the members of another row, as well as the primary key, etc. and assigns it to this row.

Parameters:

  • $row Db_Row

    The source row. Be careful -- In this case, Db does not check whether the class of the Db_Row matches. It leaves things up to you.

  • [$stripPrefix=null] String optional

    If not empty, only copies the elements with the prefix, stripping it out. Useful for assigning parts of Db_Rows that came from joins, to individual table classes.

  • [$suppressHooks=false] Boolean optional

    If true, assigns everything but does not fire the beforeSet and afterSet events.

  • [$markModified=null] Boolean | Null optional

    If set, the "modified" status of all copied fields is set to this boolean.

Returns:

Db_Row:

returns this object, for chaining

doRollback

()

Rolls back the latest transaction that was started with code that looks like $query->begin()->execute().

exportArray

(
  • [$options=null]
)

Returns a safe array to send to clients

Parameters:

  • [$options=null] $array optional

    accepts an array of options

from

(
  • $source
  • $relationName
)
DbRow | Array

Gets an row or array of rows from a source and a relation

Parameters:

  • $source DbRow | Array

    Can be a object extending Db_Row, or it can be an array of such objects, which must all be of the same class.

  • $relationName String

    The name of the relation to use in getRelated.

Returns:

DbRow | Array:

If $source is a single row and the relation was declared with hasOne, then a single row is returned. Otherwise, an associative array is returned. The keys of the associative array are the serialized keys of the rows. The values are themselves either rows, or arrays of rows, depending on whether the relation was declared with hasOne or hasMany.

get

(
  • $key1
  • $key2
  • $default
)

Gets the value of a field

Parameters:

  • $key1 String

    The name of the first key in the configuration path

  • $key2 String

    Optional. The name of the second key in the configuration path. You can actually pass as many keys as you need, delving deeper and deeper into the configuration structure. All but the last parameter are interpreted as keys.

  • $default Mixed

    Unless only one key is passed, the last parameter is the default value to return in case the requested field was not found.

getAll

() Array

Gets values of all fields

Returns:

Array:

getDb

() Db_Mysql

Gets the database to operate on, associated with this row

Returns:

getDbFromClassName

() Db

Gets the database to operateon, associated with this row

Returns:

Db:

getPKValue

() Array

Gets the primary key's value for this record, if it was retrieved. If the record was not retrieved, the primary key's value should be empty.

Returns:

Array:

An associative array with keys being all the fields that comprise the primary key index, in the order they appear in the key. The values are the values at the time the record was retrieved.

getPrimaryKey

() Array

Gets the primary key of the table

Returns:

Array:

An array naming all the fields that comprise the primary key index, in the order they appear in the key.

getRelated

(
  • $relationName
  • [$fields=array()]
  • [$inputs=array()]
  • [$modifyQuery=false]
  • $options=array()
)
Array | Db_Row | False

Get some records in a related table using foreign keys

Parameters:

  • $relationName String

    The name of the relation, or the name of a class, which extends Db_Row, representing the foreign table. We use the relations set up, in $this->getSetUp(), through the use of Db_Row::hasOne() and Db_Row::hasMeny().

  • [$fields=array()] String optional

    The fields to return

  • [$inputs=array()] Array optional

    An associative array of table_alias => DbRecord pairs. If you think of foreign tables as parent nodes, then the relation is a tree that has as its root, the table you want to return. The relation determines the joins between the tables, but you may want to specify the "input records" to limit the results using the WHERE clause. Here is an example:

  • [$modifyQuery=false] Boolean optional

    If true, returns a Db_Query object that can be modified, rather than the result. You can call more methods, like limit, offset, where, orderBy, and so forth, on that Db_Query. After you have modified it sufficiently, get the ultimate result of this function, by calling the resume() method on the Db_Query object (via the chainable interface).

  • $options=array() Array

    Array of options to pass to beforeGetRelated and beforeGetRelatedExecute functions.

Returns:

Array | Db_Row | False:

If the relation was defined with hasMany, returns an array of db rows. If the relation was defined with hasOne, returns a db row or false.

Example:

 // Assume the relation "Tags" had specified the following tree:
 // user_item_tag
 // |
 // - user
 // - item

 // Return all the tags this $user has placed on this $item.
  $user->getRelated('tags', array('i' => $item));
 // Return all the tags this $user has placed on all items.
 // Note, however, that only the Tag record portion is returned,
 // even though the Items table is still joined onto it.
  $user->getRelated('tags');

getSetUp

() &array

Gets the SetUp for this object's class

Returns:

&array:

the setUp array

getSetUpFromClass

(
  • $class_name
)
&array static

Gets the setUp for a class

Parameters:

  • $class_name String

Returns:

&array:

the setUp array

getTable

() String

Gets the table that was set to operate on

Returns:

String:

hasMany

(
  • $relationName
  • $aliases
  • $join1
)

Sets up a relation where an array is returned. For a more complex version, see hasManyEx.

Parameters:

  • $relationName String

    The name of the relation. For example, "tags" or "reviews"

  • $aliases Array

    An associative array mapping aliases to class names. Once set up, the aliases can be used in the join arrays instead of the class names. The value of the last entry of this array is the name of the ORM class that will hold each row of the result.

  • $join1 Array

    An array describing a relation between one table and another. Each pair must be of the form "a.b" => "c.d", where a and c are names of classes extending Db_Row, or their aliases from $aliases. If a join array has more than one pair, the a and c must be the same for each pair in the join array. The keys of the arrays (i.e. the string on the left-hand side) must refer to tables which have already been mentioned previously in either a key or a value. The first key of the first join array must start with the alias '{$this}' which basically refers to the table corresponding to the Db_Row on which this method was called. For example, '{$this}.name' => 'subscription.streamName'

    You can have as many of these as you want. A Db_Relation will be built that will build a tree of these for you.

hasManyEx

(
  • $relationName
  • $to_class_name
  • $alias
  • $relation
)

Set up a relation where an array is returned.

Parameters:

  • $relationName String

    The name of the relation. For example, "tags" or "reviews"

  • $to_class_name String

    The name of the ORM class which extends Db_Row, to load the result into.

  • $alias String

    The table name or alias that will refer to the table in the query corresponding to $this object.

  • $relation Db_Relation

    The relation between two or more tables, or the table with itself.

    You can pass as many Db_Relations as necessary and they are combined using Db_Relation's constructor. The only valid relations are the ones which have a single root foreign_table.

hasManyFromClass

(
  • $from_class_name
  • $relationName
  • $aliases,
  • $join1
)

Sets up a relation where an array is returned. For a more complex version, see hasManyFromClassEx.

Parameters:

  • $from_class_name String

    The name of the ORM class on which to set the relation

  • $relationName String

    The name of the relation. For example, "tags" or "reviews"

  • $aliases, Array

    An associative array mapping aliases to class names. Once set up, the aliases can be used in the join arrays instead of the class names. The value of the last entry of this array is the name of the ORM class that will hold each row of the result.

  • $join1 Array

    An array describing a relation between one table and another. Each pair must be of the form "a.b" => "c.d", where a and c are names of classes extending Db_Row, or their aliases from $aliases. If a join array has more than one pair, the a and c must be the same for each pair in the join array.

    You can have as many of these as you want. A Db_Relation will be built that will build a tree of these for you.

hasManyFromClassEx

(
  • $from_class_name
  • $relationName
  • $to_class_name
  • $alias
  • $relation
)

Set up a relation for another table, where an array is returned.

Parameters:

  • $from_class_name String

    The name of the ORM class on which to set the relation

  • $relationName String

    The name of the relation. For example, "Tags" or "Reviews"

  • $to_class_name String

    The name of the ORM class which extends Db_Row, to load the result into.

  • $alias String

    The table name or alias that will refer to the table in the query corresponding to the other object.

  • $relation Db_Relation

    The relation between two or more tables, or the table with itself.

    You can pass as many Db_Relations as necessary and they are combined using Db_Relation's constructor. The only valid relations are the ones which have a single root foreign_table, with a foreign_class_name specified. That is the class of the object created when getRelated(...) is called.

hasOne

(
  • $relationName
  • $aliases,
  • $join1
)

Set up a relation where at most one object is returned. For a more complex version, see hasOneEx.

Parameters:

  • $relationName String

    The name of the relation. For example, "mother" or "primary_email"

  • $aliases, Array

    An associative array mapping aliases to class names. Once set up, the aliases can be used in the join arrays instead of the class names. The value of the last entry of this array is the name of the ORM class that will hold each row of the result.

  • $join1 Array

    An array describing a relation between one table and another. Each pair must be of the form "a.b" => "c.d", where a and c are names of classes extending Db_Row, or their aliases from $aliases. If a join array has more than one pair, the a and c must be the same for each pair in the join array.

    You can have as many of these as you want. A Db_Relation will be built that will build a tree of these for you.

hasOneEx

(
  • $relationName
  • $to_class_name
  • $alias
  • $relation
)

Set up a relation where at most one object is returned.

Parameters:

  • $relationName String

    The name of the relation. For example, "mother" or "primary_email"

  • $to_class_name String

    The name of the ORM class which extends Db_Row, to load the result into.

  • $alias String

    The table name or alias that will refer to the table in the query corresponding to $this object.

  • $relation Db_Relation

    The relation between two or more tables, or the table with itself.

    You can pass as many Db_Relations as necessary and they are combined using Db_Relation's constructor. The only valid relations are the ones which have a single root foreign_table.

hasOneFromClass

(
  • $from_class_name
  • $relationName
  • $aliases,
  • $join1
)

Set up a relation where at most one object is returned. For a more complex version, see hasOneFromClassEx.

Parameters:

  • $from_class_name String

    The name of the ORM class on which to set the relation

  • $relationName String

    The name of the relation. For example, "mother" or "primary_email"

  • $aliases, Array

    An associative array mapping aliases to class names. Once set up, the aliases can be used in the join arrays instead of the class names. The value of the last entry of this array is the name of the ORM class that will hold each row of the result.

  • $join1 Array

    An array describing a relation between one table and another. Each pair must be of the form "a.b" => "c.d", where a and c are names of classes extending Db_Row, or their aliases from $aliases. If a join array has more than one pair, the a and c must be the same for each pair in the join array. The keys of the arrays (i.e. the string on the left-hand side) must refer to tables which have already been mentioned previously in either a key or a value. The first key of the first join array must start with the alias '{$this}' which basically refers to the table corresponding to the Db_Row on which this method was called. For example, '{$this}.name' => 'subscription.streamName'

    You can have as many of these as you want. A Db_Relation will be built that will build a tree of these for you.

hasOneFromClassEx

(
  • $from_class_name
  • $relationName
  • $to_class_name
  • $alias
  • $relation
)

Set up a relation where at most one object is returned.

Parameters:

  • $from_class_name String

    The name of the ORM class on which to set the relation

  • $relationName String

    The name of the relation. For example, "Mother" or "Primary Email"

  • $to_class_name String

    The name of the ORM class which extends Db_Row, to load the result into.

  • $alias String

    The table name or alias that will refer to the table in the query corresponding to $this object.

  • $relation Db_Relation

    The relation between two or more tables, or the table with itself.

    You can pass as many Db_Relations as necessary and they are combined using Db_Relation's constructor. The only valid relations are the ones which have a single root foreign_table.

init

(
  • [$result=null]
)

Call this function to (re-)initialize the object. Typically should only be called from the constructor.

Parameters:

  • [$result=null] Db_Result optional

    The result that produced this row through fetchDbRows

joinsToRelations

(
  • [$aliases=null]
  • [$joins=array()]
)
Array

Converts joins to an array of relations Used by hasOne and hasMany.

Parameters:

  • [$aliases=null] Array optional

    An associative array mapping aliases to class names. Once set up, the aliases can be used in the join arrays instead of the class names.

  • [$joins=array()] Array optional

    An array of associative arrays, which represent joins. This is used internally, and has rules described in hasOne and hasMany.

Returns:

Array:

An array of relations that were generated

modifiedFields

() Array

Returns array of all the fields which were modified, and their new value

Returns:

Array:

Associative array consisting of $fieldname => $value pairs.

notModified

(
  • $fieldName
)
Boolean

Marks a particular field as not modified since retrieval or creation of the object.

Parameters:

  • $fieldName String

    The name of the field

Returns:

Boolean:

Whether the field with that name was modified in the first place.

remove

(
  • [$search_criteria=null]
  • [$useIndex=null]
  • [$commit=false]
)
Integer

Deletes the rows in the database

Parameters:

  • [$search_criteria=null] String | Array optional

    You can provide custom search criteria here, such as array("tag.name LIKE " => $this->name) If this is left null, and this Db_Row was retrieved, then the db rows corresponding to the primary key are deleted. But if it wasn't retrieved, then the modified fields are used as the search criteria.

  • [$useIndex=null] Boolean optional

    If true, the primary key is used in searching for rows to delete. An exception is thrown when some fields of the primary key are not specified

  • [$commit=false] Boolean optional

    If this is TRUE, then the current transaction is committed right after the save.

Returns:

Integer:

Returns number of rows deleted

retrieve

(
  • [$fields='*']
  • [$useIndex=false]
  • [$modifyQuery=false]
  • [$options=array()]
)
Array | Db_Row | False

Retrieves the row in the database

Parameters:

  • [$fields='*'] String optional

    The fields to retrieve and set in the Db_Row. This gets used if we make a query to the database. Pass true here to fetch all fields or throw an exception if the row is missing.

  • [$useIndex=false] Boolean optional

    If true, the primary key is used in searching. An exception is thrown when some fields of the primary key are not specified

  • [$modifyQuery=false] Array | Boolean optional

    If an array, the following keys are options for modifying the query. You can call more methods, like limit, offset, where, orderBy, and so forth, on that Db_Query. After you have modified it sufficiently, get the ultimate result of this function, by calling the resume() method on the Db_Query object (via the chainable interface). You can also pass true in place of the modifyQuery field to achieve the same effect as array("query" => true)

    • [begin] Boolean | String optional

      this will cause the query to have .begin() a transaction which locks the row for update. You should call .save(..., true) to commit the transaction, or else other database connections trying to access the row will be blocked.

    • [rollbackIfMissing=false] Boolean optional

      If begin is true, this option determines whether to immediately rollback the transaction if the row we're trying to retrieve is missing.

    • [ignoreCache] Boolean optional

      If true, then call ignoreCache on the query

    • [caching] Boolean optional

      If provided, then call caching() on the query, passing this value

    • [query] Boolean optional

      If true, it will return a Db_Query that can be modified, rather than the result.

  • [$options=array()] Array optional

    Array of options to pass to beforeRetrieve and afterFetch functions.

Returns:

Array | Db_Row | False:

Returns the row fetched from the Db_Result (or returned by beforeRetrieve) If retrieve() is called with no arguments, may return false if nothing retrieved.

retrieveOrSave

(
  • [$fields='*']
  • [$modifyQuery=false]
  • [$options=array()]
)
Boolean

Retrieves the row in the database, or if it doesn't exist, saves it.

Parameters:

  • [$fields='*'] String optional

    The fields to retrieve and set in the Db_Row. This gets used if we make a query to the database.

  • [$modifyQuery=false] Array | Boolean optional

    Array of options to pass to beforeRetrieve and afterFetch functions.

  • [$options=array()] Array optional

    Array of options to pass to beforeRetrieve and afterFetch functions.

Returns:

Boolean:

returns whether the record was saved (i.e. false means retrieved)

save

(
  • [$onDuplicateKeyUpdate=false]
  • [$commit=false]
)
Boolean | Db_Query

Saves the row in the database.

If the row was retrieved from the database, issues an UPDATE. If the row was created from scratch, then issue an INSERT.

Parameters:

  • [$onDuplicateKeyUpdate=false] Boolean optional

    If MySQL is being used, you can set this to TRUE to add an ON DUPLICATE KEY UPDATE clause to the INSERT statement, or set it to an array to override specific fields with your own Db_Expressions

  • [$commit=false] Boolean optional

    If this is TRUE, then the current transaction is committed right after the save. Use this only if you started a transaction before.

Returns:

Boolean | Db_Query:

If successful, returns the Db_Query that was executed. Otherwise, returns false.

set

(
  • $key1
  • $key2
  • [$value=null]
)

Sets the value of a field

Parameters:

  • $key1 String

    The name of the first key in the configuration path

  • $key2 String

    Optional. The name of the second key in the configuration path. You can actually pass as many keys as you need, delving deeper and deeper into the configuration structure. All but the second-to-last parameter are interpreted as keys.

  • [$value=null] Mixed optional

    The last parameter should not be omitted, and contains the value to set the field to.

setDb

(
  • $db
)

Sets the database to operate on

Parameters:

setPKValue

(
  • $new_pk_value
)

Sets the primary key's value for this record. You should really call this only on Db_Row objects that were not extended by another class.

Parameters:

  • $new_pk_value Array

setPrimaryKey

(
  • $primaryKey
)

Sets up the primary key of the table

Parameters:

  • $primaryKey Array

    An array naming all the fields that comprise the primary key index, in the order they appear in the key.

setTable

(
  • $table_name
)

Sets the table to operate on

Parameters:

  • $table_name String

setUp

()

Default implementation, does nothing

toArray

()

Returns an array of fields representing this row

wasInserted

(
  • [$new_value=null]
)
Boolean

Returns whether this Db_Row was inserted into the database.

Parameters:

  • [$new_value=null] Boolean optional

    If set, then this function sets the "inserted" status to the new value. Otherwise, it just gets the "retrieved" status of the row.

Returns:

Boolean:

Whether the row is marked as inserted into the Db.

wasModified

(
  • [$fieldName=null]
)
Boolean

Returns whether a particular field was modified since retrieval or creation of the object.

Parameters:

  • [$fieldName=null] String optional

    The name of the field. You can also pass false here to mark the whole row unmodified.

Returns:

Boolean:

Whether the field with that name was modified in the first place.

wasRetrieved

(
  • [$new_value=null]
)
Boolean

Returns whether this Db_Row contains information retrieved from the database, or saved to the database.

Parameters:

  • [$new_value=null] Boolean optional

    If set, then this function sets the "retrieved" status to the new value. Otherwise, it just gets the "retrieved" status of the row.

Returns:

Boolean:

Whether the row is marked as retrieved from the Db.

Properties

$beyondLastField

Boolean protected

Beyond last field

Default: false

$fields

Array

The fields of the row

$fieldsModified

Array protected

Stores whether the fields were modified

$fieldsOriginal

Array protected

The values of the fields before they were modified

$inserted

Boolean protected

Whether this Db_Row was inserted into the database or not.

$p

Q_Tree protected

Used for setting and getting parameters on this Db_Row object which are not to be saved/retrieved to the db.

$pkValue

Array protected

The value of the primary key of the row Is set automatically if the Db_Row was fetched from a Db_Result.

$retrieved

Boolean protected

Whether this Db_Row was retrieved from, or saved to the database. The save() method uses this to decide whether to insert or update.

$setUp

Array protected

Array of settings set up for a particular class that extends Db_Row. TODO: Can be abstracted into a DbTable class later.

Events

Db/Row/$class_name/removeExecute

Before

Event Payload:

Db/Row/$class_name/removeExecute

After

Event Payload:

Db/Row/$class_name/retrieveExecute

Before

Event Payload:

Db/Row/$class_name/retrieveExecute

Before

Event Payload:

Db/Row/$class_name/saveExecute

Before

Event Payload:

Db/Row/$class_name/saveExecute

After

Event Payload: