MediaWiki
1.23.2
|
Public Member Functions | |
__construct (IORMTable $table=null, $fields=null, $loadDefaults=false) | |
Constructor. More... | |
addToField ( $field, $amount) | |
Add an amount (can be negative) to the specified field (needs to be numeric). More... | |
getField ( $name, $default=null) | |
Gets the value of a field. More... | |
getFieldNames () | |
Return the names of the fields. More... | |
getFields () | |
Return the names and values of the fields. More... | |
getId () | |
Returns the objects database id. More... | |
getSetFieldNames () | |
Return the names of the fields. More... | |
getTable () | |
Returns the table this IORMRow is a row in. More... | |
hasField ( $name) | |
Gets if a certain field is set. More... | |
hasIdField () | |
Gets if the id field is set. More... | |
loadAndGetField ( $name) | |
Gets the value of a field but first loads it if not done so already. More... | |
loadDefaults ( $override=true) | |
Load the default values, via getDefaults. More... | |
loadFields ( $fields=null, $override=true, $skipLoaded=false) | |
Load the specified fields from the database. More... | |
loadSummaryFields ( $summaryFields=null) | |
Computes and updates the values of the summary fields. More... | |
remove () | |
Removes the object from the database. More... | |
removeField ( $name) | |
Remove a field. More... | |
save ( $functionName=null) | |
Writes the answer to the database, either updating it when it already exists, or inserting it when it doesn't. More... | |
setField ( $name, $value) | |
Sets the value of a field. More... | |
setFields (array $fields, $override=true) | |
Sets multiple fields. More... | |
setId ( $id) | |
Sets the objects database id. More... | |
setSummaryMode ( $summaryMode) | |
Sets the value for the. More... | |
setUpdateSummaries ( $update) | |
Sets the value for the. More... | |
toArray ( $fields=null, $incNullId=false) | |
Serializes the object to an associative array which can then easily be converted into JSON or similar. More... | |
Protected Member Functions | |
beforeRemove () | |
Gets called before an object is removed from the database. More... | |
getBeforeRemoveFields () | |
Before removal of an object happens,. More... | |
getUpdateConditions () | |
Returns the WHERE considtions needed to identify this object so it can be updated. More... | |
getWriteValues () | |
Gets the fields => values to write to the table. More... | |
insert ( $functionName=null, array $options=null) | |
Inserts the object into the database. More... | |
onRemoved () | |
Gets called after successful removal. More... | |
saveExisting ( $functionName=null) | |
Updates the object in the database. More... | |
Protected Attributes | |
array | $fields = array( 'id' => null ) |
The fields of the object. More... | |
bool | $inSummaryMode = false |
Indicates if the object is in summary mode. More... | |
ORMTable null | $table |
bool | $updateSummaries = true |
If the object should update summaries of linked items when changed. More... | |
Definition at line 34 of file ORMRow.php.
Constructor.
IORMTable | null | $table | Deprecated since 1.22 |
array | null | $fields | |
boolean | $loadDefaults | Deprecated since 1.22 |
Definition at line 79 of file ORMRow.php.
References $fields, $table, array(), setFields(), and table.
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 527 of file ORMRow.php.
References getUpdateConditions(), and table.
|
protected |
Gets called before an object is removed from the database.
Definition at line 449 of file ORMRow.php.
References getBeforeRemoveFields(), and loadFields().
Referenced by remove().
|
protected |
Before removal of an object happens,.
Definition at line 463 of file ORMRow.php.
References array().
Referenced by beforeRemove().
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 150 of file ORMRow.php.
References $name, and hasField().
Referenced by getId(), hasIdField(), loadAndGetField(), SiteSQLStore\siteFromRow(), and toArray().
ORMRow::getFieldNames | ( | ) |
Return the names of the fields.
Implements IORMRow.
Definition at line 539 of file ORMRow.php.
References table.
ORMRow::getFields | ( | ) |
Return the names and values of the fields.
Implements IORMRow.
Definition at line 485 of file ORMRow.php.
References $fields.
ORMRow::getId | ( | ) |
Returns the objects database id.
Implements IORMRow.
Definition at line 196 of file ORMRow.php.
References getField().
Referenced by getUpdateConditions(), and loadFields().
ORMRow::getSetFieldNames | ( | ) |
Return the names of the fields.
Implements IORMRow.
Definition at line 496 of file ORMRow.php.
Referenced by toArray().
ORMRow::getTable | ( | ) |
Returns the table this IORMRow is a row in.
Implements IORMRow.
Definition at line 586 of file ORMRow.php.
References $table.
|
protected |
Returns the WHERE considtions needed to identify this object so it can be updated.
Definition at line 386 of file ORMRow.php.
References array(), and getId().
Referenced by addToField(), and saveExisting().
|
protected |
Gets the fields => values to write to the table.
Definition at line 243 of file ORMRow.php.
References $name, $type, $value, array(), as, and table.
Referenced by insert(), and saveExisting().
ORMRow::hasField | ( | $name | ) |
Gets if a certain field is set.
string | $name |
Implements IORMRow.
Definition at line 220 of file ORMRow.php.
References $name.
Referenced by getField(), hasIdField(), loadAndGetField(), setFields(), SiteSQLStore\siteFromRow(), and toArray().
ORMRow::hasIdField | ( | ) |
Gets if the id field is set.
Implements IORMRow.
Definition at line 231 of file ORMRow.php.
References getField(), and hasField().
|
protected |
Inserts the object into the database.
string | null | $functionName | |
array | null | $options |
Definition at line 401 of file ORMRow.php.
References $options, $success, getWriteValues(), setField(), and table.
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 170 of file ORMRow.php.
References $name, array(), getField(), hasField(), and loadFields().
ORMRow::loadDefaults | ( | $override = true | ) |
Load the default values, via getDefaults.
boolean | $override |
Implements IORMRow.
Definition at line 329 of file ORMRow.php.
References setFields(), and table.
Load the specified fields from the database.
array | null | $fields | |
boolean | $override | |
boolean | $skipLoaded |
Implements IORMRow.
Definition at line 105 of file ORMRow.php.
References $fields, array(), getId(), setFields(), and table.
Referenced by beforeRemove(), and loadAndGetField().
ORMRow::loadSummaryFields | ( | $summaryFields = null | ) |
Computes and updates the values of the summary fields.
array | string | null | $summaryFields |
Implements IORMRow.
Definition at line 551 of file ORMRow.php.
|
protected |
Gets called after successful removal.
Can be overridden to get rid of linked data.
Definition at line 474 of file ORMRow.php.
References setField().
Referenced by remove().
ORMRow::remove | ( | ) |
Removes the object from the database.
Implements IORMRow.
Definition at line 431 of file ORMRow.php.
References $success, beforeRemove(), onRemoved(), and table.
ORMRow::removeField | ( | $name | ) |
Remove a field.
string | $name |
Implements IORMRow.
Definition at line 185 of file ORMRow.php.
References $name.
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.
References hasIdField(), and table.
|
protected |
Updates the object in the database.
string | null | $functionName |
Definition at line 362 of file ORMRow.php.
References $success, getUpdateConditions(), getWriteValues(), and table.
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 512 of file ORMRow.php.
Referenced by insert(), onRemoved(), setFields(), and setId().
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.
References $fields, $name, $value, as, hasField(), and setField().
Referenced by __construct(), loadDefaults(), and loadFields().
ORMRow::setId | ( | $id | ) |
Sets the objects database id.
integer | null | $id |
Implements IORMRow.
Definition at line 207 of file ORMRow.php.
References setField().
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.
References $fields, array(), as, getField(), getSetFieldNames(), hasField(), and hasIdField().
The fields of the object.
field name (w/o prefix) => value
Definition at line 41 of file ORMRow.php.
Referenced by __construct(), getFields(), loadFields(), setFields(), and toArray().
|
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 62 of file ORMRow.php.
|
protected |
Definition at line 68 of file ORMRow.php.
Referenced by __construct(), and getTable().
|
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 52 of file ORMRow.php.