
Public Member Functions | |
| commit ($updateObj=false) | |
| Save this object's attributes to a record in the database. | |
| copy ($asNew=false) | |
| Attempts to make a copy of this object. | |
| finishDelete ($status) | |
| Completes the DELETE operation at the end of the transaction. | |
| finishInsert ($status) | |
| Completes the INSERT operation at the end of the transaction. | |
| finishUpdate ($status) | |
| Completes the UPDATE operation at the end of the transaction. | |
| fromDB ($rep) | |
| Populate this object based on a link or representation stored in a foreign database field. | |
| getConstraintForPrimaryKey ($skipStorageCheck=false) | |
| Get a constraints array that uniquely specifies this object by its primary key. | |
| getFormatted ($field, $format) | |
| Retrieves a DATE/TIME field and formats it. | |
| getPrimaryKey () | |
| Retrieves primary key attribute name for this object. | |
| getTableName () | |
| Retrieves name of table this object represents. | |
| getXML ($options=array()) | |
| Overridden getXML() more specific for database classes. | |
| isDatabaseAttribute ($attrName) | |
| Determines if given attribute is one that should go into the database. | |
| populate ($constraints, $multi=false) | |
| Populate this object's attributes from a record in the database. | |
| populateFromResults ($results) | |
| Populates this object from query results. | |
| populateFromResultsMulti ($results, $mapping=null, $as=null) | |
| Populates this object from query results. | |
| setFormatted ($field, $newValue) | |
| Updates a DATE/TIME field and formats according to what DB requires. | |
| toDB () | |
| Provide a link to or representation of this object for storage in a foreign database field. | |
Static Public Member Functions | |
| static | isDatabaseAttributeStatic ($info) |
| Determines if a given attribute is one that should go into the database. | |
Protected Member Functions | |
| onDelete () | |
| Callback that is invoked during a DELETE operation. | |
| onDeleteFinish () | |
| Callback that is invoked after a DELETE operation. | |
| onInsert ($what) | |
| Callback that is invoked during an INSERT operation. | |
| onInsertFinish () | |
| Callback that is invoked after an INSERT operation. | |
| onUpdate ($what) | |
| Callback that is invoked during an UPDATE operation. | |
| onUpdateFinish () | |
| Callback that is invoked after an UPDATE operation. | |
| populateWith (&$row, $mapping=null, $as=null) | |
| Initialize this object with data from a JOIN. | |
| prepareUpdate ($isUpdate) | |
| Grabs attributes to be committed, among other things. | |
| registerDBI ($DBI) | |
| Register this object's DBI@ with the parent class. | |
| registerPrimaryKey ($primaryKey, $isAuto=true) | |
| Register this object's primary key name with the parent class. | |
| registerTableName ($tableName) | |
| Register this object's table name with the parent class. | |
| setAttrsFromDBResult ($dbResult) | |
| Set this object's attributes from a DBResult object. | |
| setAttrsFromMultiDBResult ($dbResult, $mapping=null, $as=null) | |
| Set this object's attributes from a DBResult object. | |
Static Protected Member Functions | |
| static | getListBase ($DBI, $constraints, $limit, $order, $count, $objClass, $asObjects=true, $extraJoins=array(), $groupBy=array(), $extraAttrs=array()) |
| Do the bulk of the work for getList() requests. | |
| static | getListBaseMulti ($DBI, $constraints, $limit, $order, $count, $objClass, $asObjects=true, $depth=1, $extraJoins=array(), $groupBy=array(), $extraAttrs=array(), $extraTables=array()) |
| Retrieves list of objects using JOINs. | |
This class provides the object-relational mapping (ORM) for an object that will be read from/written to a database. Extend this object to inherit functions for finding/loading/saving your object to/from the database.
This class inherits from SModel2 all features needed to manage a set of attributes, but the functions in this class are specific to using a database for storage.
This is an abstract class that should be extended by model classes that map to actual database tables. When extending this class, you should immediately define static variables that define your database, table, and attributes:
Updated 2/26/09
Definition at line 31 of file SDatabaseModel.php5.
| SDatabaseModel::commit | ( | $ | updateObj = false |
) |
Save this object's attributes to a record in the database.
The database model commit function does the following:
Reimplemented from SModel2.
Reimplemented in View_SDRResourceDetails, and View_SDRResourceMinimal.
Definition at line 370 of file SDatabaseModel.php5.
References finishDelete(), finishInsert(), finishUpdate(), getConstraintForPrimaryKey(), getPrimaryKey(), getTableName(), SObject::hasError(), SModel2::isMarkedForDeletion(), SModel2::isStored(), SModel2::isValid(), onDelete(), onInsert(), onUpdate(), prepareUpdate(), and SObject::setError().
Referenced by CSERDuser::addcomment(), CSERDreview::addcomment(), AuthUser::addConfirmEmail(), AuthEmailTemplate::addEmailHeader(), AuthPermission::addGenGroupToPermission(), AuthGenGroup::addGenGroupToPermission(), AuthUser::addResetPassword(), CSERDreview::addresponse(), CSERDquestion::addresponse(), CSERDuser::addreview(), CSERDsubject::addreviewSubject(), CSERDreview::addreviewSubject(), SDRValue::addSDRDateValue(), SDRValue::addSDRFieldValue(), SDRField::addSDRFieldValue(), SDRValue::addSDRIntValue(), SDRProject::addSDRProjectField(), SDRField::addSDRProjectField(), SDRProject::addSDRResource(), SDRVersionCache::addSDRResourceCache(), SDRResource::addSDRResourceProject(), SDRProject::addSDRResourceProject(), SDRSearchWord::addSDRSearchWordCount(), SDRResource::addSDRSearchWordCount(), SDRField::addSDRSearchWordCount(), SDRValue::addSDRTextValue(), SDRResource::addSDRVersion(), SDRAgent::addSDRVersion(), SDRVersion::addSDRVersionCache(), SDRResource::addSDRVersionCache(), SDRVersion::addSDRVersionFieldValue(), SDRValue::addSDRVersionFieldValue(), SDRField::addSDRVersionFieldValue(), AuthHashType::addUser(), AuthUser::addUserConfig(), CSERDuser::adduserDetail(), CSERDdetail::adduserDetail(), CSERDuser::adduserLoginLog(), CSERDuser::adduserPageviewLog(), AuthUser::addUserToGenGroup(), AuthGenGroup::addUserToGenGroup(), AuthUser::addUserToPermission(), AuthPermission::addUserToPermission(), AuthUser::addUserToProject(), AuthProject::addUserToProject(), SDRAgent::agentFromCSERDUser(), SDRAgent::agentFromS2User(), SDRAgent::agentFromSUser(), SDRVersion::createVersion(), SDRField::findOrAddField(), SDRProjectField::findOrAddProjectField(), SDRValue::findOrAddValue(), and prepareUpdate().
| SDatabaseModel::copy | ( | $ | asNew = false |
) |
Attempts to make a copy of this object.
See SModel2::copy() for more. For database objects, this may be tricky because committing back to the DB may not be straightforward. The primary key is not copied if it is not an array since it may be auto-increment and thus should not be copied, but should be left alone.
| $asNew | [boolean]: if true, pretend this object was never in the DB |
Reimplemented from SModel2.
Definition at line 702 of file SDatabaseModel.php5.
References SModel2::getAttributeDefault().
| SDatabaseModel::finishDelete | ( | $ | status | ) |
Completes the DELETE operation at the end of the transaction.
For internal use only.
This method is called after the transaction is completed to finish deleting the object. All this method does is call the onDeleteFinish() callback and then resets this object to a raw state.
| $status | [boolean]: true if DELETE operation succeeded, falso otherwise |
Definition at line 474 of file SDatabaseModel.php5.
References SModel2::nullify(), and onDeleteFinish().
Referenced by commit().
| SDatabaseModel::finishInsert | ( | $ | status | ) |
Completes the INSERT operation at the end of the transaction.
For internal use only.
This method is called after the transaction is completed to finish deleting the object. This method must reset attributes that are marked as COMMIT_FIRST to COMMIT_CHANGED, since the object has finished inserting and now should just operate as normal. It must also update the base attributes using the current attributes. Finally, it calls onInsertFinish() to allow users of the class to do additional work after the insert.
| $status | [boolean]: true if transaction completed successfully |
Definition at line 522 of file SDatabaseModel.php5.
References SModel2::changeAttribute(), onInsertFinish(), and SModel2::updateBase().
Referenced by commit().
| SDatabaseModel::finishUpdate | ( | $ | status | ) |
Completes the UPDATE operation at the end of the transaction.
For internal use only.
This method is called after the transaction is completed to finish deleting the object. This method must reset attributes that are marked as COMMIT_FIRST to COMMIT_CHANGED, since the object has finished updating and now should just operate as normal. It must also update the base attributes using the current attributes. Finally, it calls onUpdateFinish() to allow users of the class to do additional work after the update.
| $status | [boolean]: true if transaction completed successfully |
Definition at line 494 of file SDatabaseModel.php5.
References SModel2::changeAttribute(), onUpdateFinish(), and SModel2::updateBase().
Referenced by commit().
| SDatabaseModel::fromDB | ( | $ | rep | ) |
Populate this object based on a link or representation stored in a foreign database field.
| $rep | [string]: The link/representation of the object |
Definition at line 986 of file SDatabaseModel.php5.
References populate().
| SDatabaseModel::getConstraintForPrimaryKey | ( | $ | skipStorageCheck = false |
) |
Get a constraints array that uniquely specifies this object by its primary key.
| $skipStorageCheck | [boolean]: do not use |
For internal use only.
Definition at line 670 of file SDatabaseModel.php5.
References SModel2::isStored(), and SObject::setError().
Referenced by commit().
| SDatabaseModel::getFormatted | ( | $ | field, | |
| $ | format | |||
| ) |
Retrieves a DATE/TIME field and formats it.
| $field | [string]: name of field to retrieve | |
| $format | [string]: strftime()-compatible string to format the field's value with |
Definition at line 997 of file SDatabaseModel.php5.
References SModel2::attributeExists(), DBI2::formatTimestamp(), and SObject::setError().
| static SDatabaseModel::getListBase | ( | $ | DBI, | |
| $ | constraints, | |||
| $ | limit, | |||
| $ | order, | |||
| $ | count, | |||
| $ | objClass, | |||
| $ | asObjects = true, |
|||
| $ | extraJoins = array(), |
|||
| $ | groupBy = array(), |
|||
| $ | extraAttrs = array() | |||
| ) | [static, protected] |
Do the bulk of the work for getList() requests.
For internal use only.
This function takes an optional set of constraints (no constraints will find all objects). These constraints limit the values of different attributes. This function will search table $tableName in database $DBI for rows matching the constraints. It then populates and returns an array of instances of the class that called the function.
| $DBI | [DBI2]: DBI object to query | |
| $constraints | [array]: The search constraints | |
| $limit | [array]: The search limit | |
| $order | [array]: How to order search objects | |
| $count | [boolean]: If true, only return the count of results, otherwise, return the results themselves | |
| $objClass | [string]: class name of object with which objects are created | |
| $asObjects | [bool]: if true, return array of objects, otherwise, just return resultset | |
| $extraJoins | [array]: additional joins to make in the query (see SQuery::setExtraJoins()) | |
| $groupBy | [array]: additional group by clause (see SQuery::setGroupBy()) | |
| $extraAttrs | [array]: additional attributes to be selected (see SQuery::setExtraAttrs) |
Definition at line 742 of file SDatabaseModel.php5.
References STimer::endAvg(), and STimer::startAvg().
| static SDatabaseModel::getListBaseMulti | ( | $ | DBI, | |
| $ | constraints, | |||
| $ | limit, | |||
| $ | order, | |||
| $ | count, | |||
| $ | objClass, | |||
| $ | asObjects = true, |
|||
| $ | depth = 1, |
|||
| $ | extraJoins = array(), |
|||
| $ | groupBy = array(), |
|||
| $ | extraAttrs = array(), |
|||
| $ | extraTables = array() | |||
| ) | [static, protected] |
Retrieves list of objects using JOINs.
For internal use only.
| $DBI | [DBI2]: DBI2 object to use for queries | |
| $constraints | [array]: query constraints array for WHERE clause | |
| $limit | [array]: query limit array for LIMIT clause | |
| $order | [array]: query order array for ORDER BY clause | |
| $count | [boolean]: if true, only return the count of objects that would be returned (nearly equivalent to calling getListBase() with $count = true) | |
| $objClass | [string]: class name of class to be used when creating objects | |
| $asObjects | [bool]: if true, return array of objects, otherwise, just return resultset | |
| $extraJoins | [array]: additional joins to make in the query (see SQuery::setExtraJoins()) | |
| $groupBy | [array]: additional group by clause (see SQuery::setGroupBy()) | |
| $extraAttrs | [array]: additional attributes to be selected (see SQuery::setExtraAttrs) | |
| $extraTables | [array]: additional tables to be selected (see SQuery::setExtraTables) |
Definition at line 821 of file SDatabaseModel.php5.
References STimer::endAvg(), and STimer::startAvg().
| SDatabaseModel::getPrimaryKey | ( | ) |
Retrieves primary key attribute name for this object.
Definition at line 1049 of file SDatabaseModel.php5.
Referenced by commit(), and prepareUpdate().
| SDatabaseModel::getTableName | ( | ) |
Retrieves name of table this object represents.
Definition at line 1040 of file SDatabaseModel.php5.
Referenced by commit().
| SDatabaseModel::getXML | ( | $ | options = array() |
) |
Overridden getXML() more specific for database classes.
All that this method does different is have the root node name default to the table name
| $options | [array]: array of options that control how XML is generated (see parent class) |
Reimplemented from SModel2.
Definition at line 1029 of file SDatabaseModel.php5.
| SDatabaseModel::isDatabaseAttribute | ( | $ | attrName | ) |
Determines if given attribute is one that should go into the database.
See isDatabaseAttributeStatic().
| $attrName | [string]: name of attribute to check |
Definition at line 1120 of file SDatabaseModel.php5.
References SModel2::getAttributeInfo().
| static SDatabaseModel::isDatabaseAttributeStatic | ( | $ | info | ) | [static] |
Determines if a given attribute is one that should go into the database.
Attributes that go into the database are those which are not objects and are not marked as COMMIT_NOSOURCE and are not arrays.
| $info | [array]: attribute information (as would come from getAttributeInfo()) |
Definition at line 1102 of file SDatabaseModel.php5.
References SModel2::COMMIT_NOSOURCE.
| SDatabaseModel::onDelete | ( | ) | [protected] |
Callback that is invoked during a DELETE operation.
This method is called after the row has been deleted successfully from the database, but before the transaction has completed. If it returns false, the transaction is cancelled. This method is to be used by derived classes to implement any special functionality that must take place when an object is being deleted, such as deleting, or preparing for deletion, external files. Note that this method is only called after the successful deletion of a row, not after the whole transaction succeeds. It is thus probably best to use onDeleteFinish() to do final cleanup activities as it is called after the transaction succeeds.
Definition at line 903 of file SDatabaseModel.php5.
Referenced by commit().
| SDatabaseModel::onDeleteFinish | ( | ) | [protected] |
Callback that is invoked after a DELETE operation.
This method is called when a transaction that involves this object getting deleted is complete. The database is updated and committed, so this method cannot be used to cancel a pending DELETE. It should be used to clean up any external resources associated with this object.
Definition at line 914 of file SDatabaseModel.php5.
Referenced by finishDelete().
| SDatabaseModel::onInsert | ( | $ | what | ) | [protected] |
Callback that is invoked during an INSERT operation.
This method is called after the INSERT query succeeds, but before the DB transaction is committed.
| $what | [array]: attributes and new values that will be inserted into the DB |
Definition at line 925 of file SDatabaseModel.php5.
Referenced by commit().
| SDatabaseModel::onInsertFinish | ( | ) | [protected] |
Callback that is invoked after an INSERT operation.
This method is called after the database transaction is complete and committed. The object is fully updated with new attributes and a primary key from mysql_insert_id, if needed.
Definition at line 936 of file SDatabaseModel.php5.
Referenced by finishInsert().
| SDatabaseModel::onUpdate | ( | $ | what | ) | [protected] |
Callback that is invoked during an UPDATE operation.
This method is called after the UPDATE query succeeds, but before the DB transaction is committed.
| $what | [array]: attributes and new values that will be update in the DB |
Definition at line 947 of file SDatabaseModel.php5.
Referenced by commit().
| SDatabaseModel::onUpdateFinish | ( | ) | [protected] |
Callback that is invoked after an UPDATE operation.
This method is called after the database transaction is complete and committed. The object is fully updated and needs no further changes.
Definition at line 957 of file SDatabaseModel.php5.
Referenced by finishUpdate().
| SDatabaseModel::populate | ( | $ | constraints, | |
| $ | multi = false | |||
| ) |
Populate this object's attributes from a record in the database.
The database model populate function will:
| $constraints | [array]: A set of search constraints to locate a database row | |
| $multi | [boolean]: if true, use getListBaseMulti() to grab a JOINed result set |
Definition at line 70 of file SDatabaseModel.php5.
References setAttrsFromDBResult(), setAttrsFromMultiDBResult(), SObject::setError(), and SModel2::updateBase().
Referenced by AuthUserToProject::__construct(), AuthUserToPermission::__construct(), AuthUserToGenGroup::__construct(), AuthUserConfig::__construct(), AuthUser::__construct(), AuthResetPassword::__construct(), AuthProject::__construct(), AuthPermission::__construct(), AuthInvalidLoginAttempt::__construct(), AuthHashType::__construct(), AuthGenGroupToPermission::__construct(), AuthGenGroup::__construct(), AuthEmailTemplate::__construct(), AuthEmailHeader::__construct(), AuthConfirmEmail::__construct(), View_SDRResourceMinimal::__construct(), View_SDRResourceDetails::__construct(), SDRVersionFieldValue::__construct(), SDRVersionCache::__construct(), SDRVersion::__construct(), SDRValueCache::__construct(), SDRValue::__construct(), SDRTextValue::__construct(), SDRSearchWordCount::__construct(), SDRSearchWord::__construct(), SDRResourceProject::__construct(), SDRResourceCache::__construct(), SDRResource::__construct(), SDRProjectField::__construct(), SDRProject::__construct(), SDRIntValue::__construct(), SDRFieldValue::__construct(), SDRField::__construct(), SDRDateValue::__construct(), SDRAgent::__construct(), SDRAdminLdapRole::__construct(), CSERDuserPageviewLog::__construct(), CSERDuserLoginLog::__construct(), CSERDuserDetail::__construct(), CSERDuser::__construct(), CSERDsubject::__construct(), CSERDreviewSubject::__construct(), CSERDreview::__construct(), CSERDresponse::__construct(), CSERDquestion::__construct(), CSERDnotification::__construct(), CSERDldapUser::__construct(), CSERDdetail::__construct(), CSERDcomment::__construct(), and fromDB().
| SDatabaseModel::populateFromResults | ( | $ | results | ) |
Populates this object from query results.
This allows you to populate this object using a custom query. All of the attributes relevant to this object must be named as they would be named in this object. That is, if this object has an attribute called 'foo', then the result attribute should also be called 'foo'. This is different from populateFromResultsMulti().
The results array must be two dimensional: a list of rows, each row being an associative array of attribute => value pairs. This is the same format as returned by DBI2::query()->toArray().
| $results | [array]: results array (described above) |
Definition at line 308 of file SDatabaseModel.php5.
References setAttrsFromDBResult().
| SDatabaseModel::populateFromResultsMulti | ( | $ | results, | |
| $ | mapping = null, |
|||
| $ | as = null | |||
| ) |
Populates this object from query results.
This allows you to populate this object using a custom query. All of the attributes relevant to this object must be named 'TABLE_ATTRIBUTE' (e.g. 'MyTable_ATTR_id') This is different from populateFromResults().
The results array must be two dimensional: a list of rows, each row being an associative array of attribute => value pairs. This is the same format as returned by DBI2::query()->toArray().
| $results | [array]: results array (described above) | |
| $mapping | [array]: maps table and attribute aliases (comes from SQuery::getMapping()) | |
| $as | [string]: alias of the table from which to populate this object |
Definition at line 327 of file SDatabaseModel.php5.
References setAttrsFromMultiDBResult().
| SDatabaseModel::populateWith | ( | &$ | row, | |
| $ | mapping = null, |
|||
| $ | as = null | |||
| ) | [protected] |
Initialize this object with data from a JOIN.
For internal use only.
This is used by setAttrsFromMultiDBResult() to initialize foreign key objects. It basically extracts the fields that belong to this object from the passed in row and initializes this object with the attributes. If any attributes are themselves foreign key attributes, they are used to recursively initialize the corresponding foreign key objects with more calls to populateWith().
| $row | [array]: row from DB query result | |
| $mapping | [array]: maps table and attribute aliases (comes from SQuery::getMapping()) | |
| $as | [string]: alias of the table from which to populate this object |
Definition at line 130 of file SDatabaseModel.php5.
References SModel2::getAttributeForeign(), SModel2::getAttributeType(), and SModel2::updateBase().
| SDatabaseModel::prepareUpdate | ( | $ | isUpdate | ) | [protected] |
Grabs attributes to be committed, among other things.
For internal use only.
This method grabs all attributes that need to be in the database commit query. It also checks to see if any COMMIT_FIRST attributes need to have their type changed to COMMIT_CHANGED. It takes an approach of many failures are allowed. Thus, if there are multiple errors, they will all be reported, instead of just bailing on the first error.
| $isUpdate | [boolean]: true if this is for an UPDATE, false for an INSERT |
Definition at line 550 of file SDatabaseModel.php5.
References commit(), SModel2::getAttributes(), SObject::getErrorFrom(), getPrimaryKey(), SModel2::isChanged(), SModel2::isDirty(), and SObject::setError().
Referenced by commit().
| SDatabaseModel::registerDBI | ( | $ | DBI | ) | [protected] |
Register this object's DBI@ with the parent class.
For internal use only.
Call this function from your constructor
Definition at line 1061 of file SDatabaseModel.php5.
References SObject::setError().
Referenced by AuthModelBase::__construct(), SDRModel::__construct(), ModelBase::__construct(), and CSERDModelBase::__construct().
| SDatabaseModel::registerPrimaryKey | ( | $ | primaryKey, | |
| $ | isAuto = true | |||
| ) | [protected] |
Register this object's primary key name with the parent class.
For internal use only.
| $primaryKey | [string]: The name of the primary key of this object |
Definition at line 1088 of file SDatabaseModel.php5.
Referenced by AuthUserToProject::__construct(), AuthUserToPermission::__construct(), AuthUserToGenGroup::__construct(), AuthUserConfig::__construct(), AuthUser::__construct(), AuthResetPassword::__construct(), AuthProject::__construct(), AuthPermission::__construct(), AuthHashType::__construct(), AuthGenGroupToPermission::__construct(), AuthGenGroup::__construct(), AuthEmailTemplate::__construct(), AuthEmailHeader::__construct(), AuthConfirmEmail::__construct(), View_SDRResourceMinimal::__construct(), View_SDRResourceDetails::__construct(), SDRVersionFieldValue::__construct(), SDRVersionCache::__construct(), SDRVersion::__construct(), SDRValueCache::__construct(), SDRValue::__construct(), SDRTextValue::__construct(), SDRSearchWordCount::__construct(), SDRSearchWord::__construct(), SDRResourceProject::__construct(), SDRResourceCache::__construct(), SDRResource::__construct(), SDRProjectField::__construct(), SDRProject::__construct(), SDRIntValue::__construct(), SDRFieldValue::__construct(), SDRField::__construct(), SDRDateValue::__construct(), SDRAgent::__construct(), CSERDuserPageviewLog::__construct(), CSERDuserLoginLog::__construct(), CSERDuser::__construct(), CSERDsubject::__construct(), CSERDreview::__construct(), CSERDresponse::__construct(), CSERDquestion::__construct(), CSERDnotification::__construct(), CSERDdetail::__construct(), and CSERDcomment::__construct().
| SDatabaseModel::registerTableName | ( | $ | tableName | ) | [protected] |
Register this object's table name with the parent class.
For internal use only.
| $tableName | [string]: The name of the table mapping to this object |
Definition at line 1077 of file SDatabaseModel.php5.
Referenced by AuthUserToProject::__construct(), AuthUserToPermission::__construct(), AuthUserToGenGroup::__construct(), AuthUserConfig::__construct(), AuthUser::__construct(), AuthResetPassword::__construct(), AuthProject::__construct(), AuthPermission::__construct(), AuthInvalidLoginAttempt::__construct(), AuthHashType::__construct(), AuthGenGroupToPermission::__construct(), AuthGenGroup::__construct(), AuthEmailTemplate::__construct(), AuthEmailHeader::__construct(), AuthConfirmEmail::__construct(), View_SDRResourceMinimal::__construct(), View_SDRResourceDetails::__construct(), SDRVersionFieldValue::__construct(), SDRVersionCache::__construct(), SDRVersion::__construct(), SDRValueCache::__construct(), SDRValue::__construct(), SDRTextValue::__construct(), SDRSearchWordCount::__construct(), SDRSearchWord::__construct(), SDRResourceProject::__construct(), SDRResourceCache::__construct(), SDRResource::__construct(), SDRProjectField::__construct(), SDRProject::__construct(), SDRIntValue::__construct(), SDRFieldValue::__construct(), SDRField::__construct(), SDRDateValue::__construct(), SDRAgent::__construct(), SDRAdminLdapRole::__construct(), CSERDuserPageviewLog::__construct(), CSERDuserLoginLog::__construct(), CSERDuserDetail::__construct(), CSERDuser::__construct(), CSERDsubject::__construct(), CSERDreviewSubject::__construct(), CSERDreview::__construct(), CSERDresponse::__construct(), CSERDquestion::__construct(), CSERDnotification::__construct(), CSERDldapUser::__construct(), CSERDdetail::__construct(), and CSERDcomment::__construct().
| SDatabaseModel::setAttrsFromDBResult | ( | $ | dbResult | ) | [protected] |
Set this object's attributes from a DBResult object.
For internal use only.
| $dbResult | [DBResult row]: row from DB query result |
Definition at line 186 of file SDatabaseModel.php5.
References SModel2::changeAttribute(), SModel2::getAttributes(), and SObject::setError().
Referenced by populate(), and populateFromResults().
| SDatabaseModel::setAttrsFromMultiDBResult | ( | $ | dbResult, | |
| $ | mapping = null, |
|||
| $ | as = null | |||
| ) | [protected] |
Set this object's attributes from a DBResult object.
For internal use only.
| $dbResult | [DBResult row]: row from DB query | |
| $mapping | [array]: maps table and attribute aliases (comes from SQuery::getMapping()) | |
| $as | [string]: alias of the table from which to populate this object |
Definition at line 242 of file SDatabaseModel.php5.
References SModel2::changeAttribute(), SModel2::getAttributes(), SModel2::getAttributeType(), and SObject::setError().
Referenced by populate(), and populateFromResultsMulti().
| SDatabaseModel::setFormatted | ( | $ | field, | |
| $ | newValue | |||
| ) |
Updates a DATE/TIME field and formats according to what DB requires.
| $field | [string]: name of field to update | |
| $newValue | [string]: some type of time/date-indicating string that will be converged to standard DB format |
Definition at line 1012 of file SDatabaseModel.php5.
References SModel2::attributeExists(), and SObject::setError().
| SDatabaseModel::toDB | ( | ) |
Provide a link to or representation of this object for storage in a foreign database field.
Override this function to return a value that will represent or link to this object. By default, it returns the object's primary key -- to be stored as a foreign key during a commit by another object.
Definition at line 974 of file SDatabaseModel.php5.
1.5.6