MediaWiki
REL1_22
|
Public Member Functions | |
__construct (IORMTable $table=null, $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. | |
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 successful 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 null | $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 = null , |
$ | fields = null , |
||
$ | loadDefaults = false |
||
) |
Constructor.
IORMTable | null | $table | Deprecated since 1.22 |
array | null | $fields | |
boolean | $loadDefaults | Deprecated since 1.22 |
Definition at line 80 of file ORMRow.php.
ORMRow::addToField | ( | $ | field, |
$ | amount | ||
) |
Add an amount (can be negative) to the specified field (needs to be numeric).
string | $field | |
integer | $amount |
Implements IORMRow.
Definition at line 526 of file ORMRow.php.
ORMRow::beforeRemove | ( | ) | [protected] |
Gets called before an object is removed from the database.
Definition at line 449 of file ORMRow.php.
ORMRow::getBeforeRemoveFields | ( | ) | [protected] |
Before removal of an object happens,.
Definition at line 462 of file ORMRow.php.
ORMRow::getField | ( | $ | name, |
$ | default = null |
||
) |
Gets the value of a field.
string | $name | Field name |
$default | mixed: Default value to return when none is found (default: null) |
MWException |
Implements IORMRow.
Definition at line 149 of file ORMRow.php.
Return the names of the fields.
Implements IORMRow.
Definition at line 538 of file ORMRow.php.
Return the names and values of the fields.
Implements IORMRow.
Definition at line 484 of file ORMRow.php.
ORMRow::getId | ( | ) |
Returns the objects database id.
Implements IORMRow.
Definition at line 195 of file ORMRow.php.
Return the names of the fields.
Implements IORMRow.
Definition at line 495 of file ORMRow.php.
ORMRow::getTable | ( | ) |
Returns the table this IORMRow is a row in.
Implements IORMRow.
Definition at line 586 of file ORMRow.php.
ORMRow::getUpdateConditions | ( | ) | [protected] |
Returns the WHERE considtions needed to identify this object so it can be updated.
Definition at line 386 of file ORMRow.php.
ORMRow::getWriteValues | ( | ) | [protected] |
Gets the fields => values to write to the table.
Definition at line 243 of file ORMRow.php.
ORMRow::hasField | ( | $ | name | ) |
Gets if a certain field is set.
string | $name |
Implements IORMRow.
Definition at line 219 of file ORMRow.php.
Gets if the id field is set.
Implements IORMRow.
Definition at line 230 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 401 of file ORMRow.php.
ORMRow::loadAndGetField | ( | $ | name | ) |
Gets the value of a field but first loads it if not done so already.
$name | string |
Implements IORMRow.
Definition at line 169 of file ORMRow.php.
ORMRow::loadDefaults | ( | $ | override = true | ) |
Load the default values, via getDefaults.
boolean | $override |
Implements IORMRow.
Definition at line 329 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 106 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 550 of file ORMRow.php.
ORMRow::onRemoved | ( | ) | [protected] |
Gets called after successful removal.
Can be overridden to get rid of linked data.
Definition at line 473 of file ORMRow.php.
ORMRow::remove | ( | ) |
Removes the object from the database.
Implements IORMRow.
Definition at line 431 of file ORMRow.php.
ORMRow::removeField | ( | $ | name | ) |
Remove a field.
string | $name |
Implements IORMRow.
Definition at line 184 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 344 of file ORMRow.php.
ORMRow::saveExisting | ( | $ | functionName = null | ) | [protected] |
Updates the object in the database.
string | null | $functionName |
Definition at line 362 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 511 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 279 of file ORMRow.php.
ORMRow::setId | ( | $ | id | ) |
Sets the objects database id.
integer | null | $id |
Implements IORMRow.
Definition at line 206 of file ORMRow.php.
ORMRow::setSummaryMode | ( | $ | summaryMode | ) |
Sets the value for the.
boolean | $summaryMode |
Implements IORMRow.
Definition at line 574 of file ORMRow.php.
ORMRow::setUpdateSummaries | ( | $ | update | ) |
Sets the value for the.
boolean | $update |
Implements IORMRow.
Definition at line 562 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 298 of file ORMRow.php.
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 63 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 53 of file ORMRow.php.