MediaWiki
REL1_20
|
Public Member Functions | |
__construct (IORMTable $table, $fields=null, $loadDefaults=false) | |
Constructor. | |
addToField ($field, $amount) | |
Add an amount (can be negative) to the specified field (needs to be numeric). | |
getField ($name, $default=null) | |
Gets the value of a field. | |
getFieldNames () | |
Return the names of the fields. | |
getFields () | |
Return the names and values of the fields. | |
getId () | |
Returns the objects database id. | |
getSetFieldNames () | |
Return the names of the fields. | |
getTable () | |
Returns the table this IORMRow is a row in. | |
hasField ($name) | |
Gets if a certain field is set. | |
hasIdField () | |
Gets if the id field is set. | |
loadAndGetField ($name) | |
Gets the value of a field but first loads it if not done so already. | |
loadDefaults ($override=true) | |
Load the default values, via getDefaults. | |
loadFields ($fields=null, $override=true, $skipLoaded=false) | |
Load the specified fields from the database. | |
loadSummaryFields ($summaryFields=null) | |
Computes and updates the values of the summary fields. | |
remove () | |
Removes the object from the database. | |
removeField ($name) | |
Remove a field. | |
save ($functionName=null) | |
Writes the answer to the database, either updating it when it already exists, or inserting it when it doesn't. | |
setField ($name, $value) | |
Sets the value of a field. | |
setFields (array $fields, $override=true) | |
Sets multiple fields. | |
setId ($id) | |
Sets the objects database id. | |
setSummaryMode ($summaryMode) | |
Sets the value for the. | |
setUpdateSummaries ($update) | |
Sets the value for the. | |
toArray ($fields=null, $incNullId=false) | |
Serializes the object to an associative array which can then easily be converted into JSON or similar. | |
Protected Member Functions | |
beforeRemove () | |
Gets called before an object is removed from the database. | |
fieldsChanged (IORMRow $object, $excludeSummaryFields=false) | |
Return if any fields got changed. | |
getBeforeRemoveFields () | |
Before removal of an object happens,. | |
getUpdateConditions () | |
Returns the WHERE considtions needed to identify this object so it can be updated. | |
getWriteValues () | |
Gets the fields => values to write to the table. | |
insert ($functionName=null, array $options=null) | |
Inserts the object into the database. | |
onRemoved () | |
Gets called after successfull removal. | |
saveExisting ($functionName=null) | |
Updates the object in the database. | |
Protected Attributes | |
array | $fields = array( 'id' => null ) |
The fields of the object. | |
bool | $inSummaryMode = false |
Indicates if the object is in summary mode. | |
ORMTable | $table |
bool | $updateSummaries = true |
If the object should update summaries of linked items when changed. |
Definition at line 34 of file ORMRow.php.
ORMRow::__construct | ( | IORMTable $ | table, |
$ | fields = null , |
||
$ | loadDefaults = false |
||
) |
Constructor.
IORMTable | $table | |
array | null | $fields | |
boolean | $loadDefaults |
Implements IORMRow.
Definition at line 77 of file ORMRow.php.
ORMRow::addToField | ( | $ | field, |
$ | amount | ||
) |
Add an amount (can be negative) to the specified field (needs to be numeric).
TODO: most off this stuff makes more sense in the table class
string | $field | |
integer | $amount |
Implements IORMRow.
Definition at line 544 of file ORMRow.php.
ORMRow::beforeRemove | ( | ) | [protected] |
Gets called before an object is removed from the database.
Definition at line 427 of file ORMRow.php.
ORMRow::fieldsChanged | ( | IORMRow $ | object, |
$ | excludeSummaryFields = false |
||
) | [protected] |
Return if any fields got changed.
IORMRow | $object | |
boolean | array | $excludeSummaryFields | When set to true, summary field changes are ignored. Can also be an array of fields to ignore. |
Definition at line 630 of file ORMRow.php.
ORMRow::getBeforeRemoveFields | ( | ) | [protected] |
Before removal of an object happens,.
Definition at line 440 of file ORMRow.php.
ORMRow::getField | ( | $ | name, |
$ | default = null |
||
) |
Gets the value of a field.
string | $name | |
mixed | $default |
MWException |
Implements IORMRow.
Definition at line 143 of file ORMRow.php.
Return the names of the fields.
Implements IORMRow.
Definition at line 581 of file ORMRow.php.
Return the names and values of the fields.
Implements IORMRow.
Definition at line 461 of file ORMRow.php.
ORMRow::getId | ( | ) |
Returns the objects database id.
Implements IORMRow.
Definition at line 188 of file ORMRow.php.
Return the names of the fields.
Implements IORMRow.
Definition at line 472 of file ORMRow.php.
ORMRow::getTable | ( | ) |
Returns the table this IORMRow is a row in.
Implements IORMRow.
Definition at line 655 of file ORMRow.php.
ORMRow::getUpdateConditions | ( | ) | [protected] |
Returns the WHERE considtions needed to identify this object so it can be updated.
Definition at line 366 of file ORMRow.php.
ORMRow::getWriteValues | ( | ) | [protected] |
Gets the fields => values to write to the table.
Definition at line 251 of file ORMRow.php.
ORMRow::hasField | ( | $ | name | ) |
Gets if a certain field is set.
string | $name |
Implements IORMRow.
Definition at line 212 of file ORMRow.php.
Gets if the id field is set.
Implements IORMRow.
Definition at line 223 of file ORMRow.php.
ORMRow::insert | ( | $ | functionName = null , |
array $ | options = null |
||
) | [protected] |
Inserts the object into the database.
string | null | $functionName | |
array | null | $options |
Definition at line 380 of file ORMRow.php.
ORMRow::loadAndGetField | ( | $ | name | ) |
Gets the value of a field but first loads it if not done so already.
string$name |
Implements IORMRow.
Definition at line 162 of file ORMRow.php.
ORMRow::loadDefaults | ( | $ | override = true | ) |
Load the default values, via getDefaults.
boolean | $override |
Implements IORMRow.
Definition at line 313 of file ORMRow.php.
ORMRow::loadFields | ( | $ | fields = null , |
$ | override = true , |
||
$ | skipLoaded = false |
||
) |
Load the specified fields from the database.
array | null | $fields | |
boolean | $override | |
boolean | $skipLoaded |
Implements IORMRow.
Definition at line 102 of file ORMRow.php.
ORMRow::loadSummaryFields | ( | $ | summaryFields = null | ) |
Computes and updates the values of the summary fields.
array | string | null | $summaryFields |
Implements IORMRow.
Definition at line 592 of file ORMRow.php.
ORMRow::onRemoved | ( | ) | [protected] |
Gets called after successfull removal.
Can be overriden to get rid of linked data.
Definition at line 450 of file ORMRow.php.
ORMRow::remove | ( | ) |
Removes the object from the database.
Implements IORMRow.
Definition at line 407 of file ORMRow.php.
ORMRow::removeField | ( | $ | name | ) |
Remove a field.
string | $name |
Implements IORMRow.
Definition at line 177 of file ORMRow.php.
ORMRow::save | ( | $ | functionName = null | ) |
Writes the answer to the database, either updating it when it already exists, or inserting it when it doesn't.
string | null | $functionName |
Implements IORMRow.
Definition at line 327 of file ORMRow.php.
ORMRow::saveExisting | ( | $ | functionName = null | ) | [protected] |
Updates the object in the database.
string | null | $functionName |
Definition at line 344 of file ORMRow.php.
ORMRow::setField | ( | $ | name, |
$ | value | ||
) |
Sets the value of a field.
Strings can be provided for other types, so this method can be called from unserialization handlers.
string | $name | |
mixed | $value |
MWException |
Implements IORMRow.
Definition at line 488 of file ORMRow.php.
ORMRow::setFields | ( | array $ | fields, |
$ | override = true |
||
) |
Sets multiple fields.
array | $fields | The fields to set |
boolean | $override | Override already set fields with the provided values? |
Implements IORMRow.
Definition at line 236 of file ORMRow.php.
ORMRow::setId | ( | $ | id | ) |
Sets the objects database id.
integer | null | $id |
Implements IORMRow.
Definition at line 199 of file ORMRow.php.
ORMRow::setSummaryMode | ( | $ | summaryMode | ) |
Sets the value for the.
boolean | $summaryMode |
Implements IORMRow.
Definition at line 614 of file ORMRow.php.
ORMRow::setUpdateSummaries | ( | $ | update | ) |
Sets the value for the.
boolean | $update |
Implements IORMRow.
Definition at line 603 of file ORMRow.php.
ORMRow::toArray | ( | $ | fields = null , |
$ | incNullId = false |
||
) |
Serializes the object to an associative array which can then easily be converted into JSON or similar.
null | array | $fields | |
boolean | $incNullId |
Implements IORMRow.
Definition at line 283 of file ORMRow.php.
array ORMRow::$fields = array( 'id' => null ) [protected] |
The fields of the object.
field name (w/o prefix) => value
Definition at line 42 of file ORMRow.php.
bool ORMRow::$inSummaryMode = false [protected] |
Indicates if the object is in summary mode.
This mode indicates that only summary fields got updated, which allows for optimizations.
Definition at line 66 of file ORMRow.php.
ORMTable ORMRow::$table [protected] |
Definition at line 47 of file ORMRow.php.
bool ORMRow::$updateSummaries = true [protected] |
If the object should update summaries of linked items when changed.
For example, update the course_count field in universities when a course in courses is deleted. Settings this to false can prevent needless updating work in situations such as deleting a university, which will then delete all it's courses.
Definition at line 57 of file ORMRow.php.