MediaWiki  REL1_24
ORMRow Class Reference
Inheritance diagram for ORMRow:
Collaboration diagram for ORMRow:

List of all members.

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.

Detailed Description

Definition at line 34 of file ORMRow.php.


Constructor & Destructor Documentation

ORMRow::__construct ( IORMTable table = null,
fields = null,
loadDefaults = false 
)

Constructor.

Since:
1.20
Parameters:
IORMTable | null$tableDeprecated since 1.22
array | null$fields
bool$loadDefaultsDeprecated since 1.22

Definition at line 79 of file ORMRow.php.


Member Function Documentation

ORMRow::addToField ( field,
amount 
)

Add an amount (can be negative) to the specified field (needs to be numeric).

Since:
1.20
Deprecated:
since 1.22, use IORMTable->addToField
Parameters:
string$field
int$amount
Returns:
bool Success indicator

Implements IORMRow.

Definition at line 527 of file ORMRow.php.

ORMRow::beforeRemove ( ) [protected]

Gets called before an object is removed from the database.

Since:
1.20
Deprecated:
since 1.22

Definition at line 449 of file ORMRow.php.

Before removal of an object happens,.

See also:
beforeRemove gets called. This method loads the fields of which the names have been returned by this one (or all fields if null is returned). This allows for loading info needed after removal to get rid of linked data and the like.
Since:
1.20
Returns:
array|null

Definition at line 463 of file ORMRow.php.

ORMRow::getField ( name,
default = null 
)

Gets the value of a field.

Since:
1.20
Parameters:
string$nameField name
mixed$defaultDefault value to return when none is found (default: null)
Exceptions:
MWException
Returns:
mixed

Implements IORMRow.

Definition at line 150 of file ORMRow.php.

Return the names of the fields.

Since:
1.20
Deprecated:
since 1.22
Returns:
array

Implements IORMRow.

Definition at line 539 of file ORMRow.php.

Return the names and values of the fields.

Since:
1.20
Returns:
array

Implements IORMRow.

Definition at line 485 of file ORMRow.php.

Returns the objects database id.

Since:
1.20
Returns:
int|null

Implements IORMRow.

Definition at line 196 of file ORMRow.php.

Return the names of the fields.

Since:
1.20
Returns:
array

Implements IORMRow.

Definition at line 496 of file ORMRow.php.

Returns the table this IORMRow is a row in.

Since:
1.20
Deprecated:
since 1.22
Returns:
IORMTable

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.

Since:
1.20
Returns:
array

Definition at line 386 of file ORMRow.php.

ORMRow::getWriteValues ( ) [protected]

Gets the fields => values to write to the table.

Since:
1.20
Deprecated:
since 1.22
Returns:
array

Definition at line 243 of file ORMRow.php.

ORMRow::hasField ( name)

Gets if a certain field is set.

Since:
1.20
Parameters:
string$name
Returns:
bool

Implements IORMRow.

Definition at line 220 of file ORMRow.php.

Gets if the id field is set.

Since:
1.20
Returns:
bool

Implements IORMRow.

Definition at line 231 of file ORMRow.php.

ORMRow::insert ( functionName = null,
array options = null 
) [protected]

Inserts the object into the database.

Since:
1.20
Deprecated:
since 1.22
Parameters:
string | null$functionName
array | null$options
Returns:
bool Success indicator

Definition at line 401 of file ORMRow.php.

Gets the value of a field but first loads it if not done so already.

Since:
1.20
Deprecated:
since 1.22
Parameters:
string$name
Returns:
mixed

Implements IORMRow.

Definition at line 170 of file ORMRow.php.

ORMRow::loadDefaults ( override = true)

Load the default values, via getDefaults.

Since:
1.20
Deprecated:
since 1.22
Parameters:
bool$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.

Since:
1.20
Deprecated:
since 1.22
Parameters:
array | null$fields
bool$override
bool$skipLoaded
Returns:
bool Success indicator

Implements IORMRow.

Definition at line 105 of file ORMRow.php.

ORMRow::loadSummaryFields ( summaryFields = null)

Computes and updates the values of the summary fields.

Since:
1.20
Deprecated:
since 1.22
Parameters:
array | string | null$summaryFields

Implements IORMRow.

Definition at line 551 of file ORMRow.php.

ORMRow::onRemoved ( ) [protected]

Gets called after successful removal.

Can be overridden to get rid of linked data.

Since:
1.20
Deprecated:
since 1.22

Definition at line 474 of file ORMRow.php.

Removes the object from the database.

Since:
1.20
Deprecated:
since 1.22, use IORMTable->removeRow
Returns:
bool Success indicator

Implements IORMRow.

Definition at line 431 of file ORMRow.php.

ORMRow::removeField ( name)

Remove a field.

Since:
1.20
Parameters:
string$name

Implements IORMRow.

Definition at line 185 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.

Since:
1.20
Deprecated:
since 1.22 Use IORMTable->updateRow or ->insertRow
Parameters:
string | null$functionName
Returns:
bool Success indicator

Implements IORMRow.

Definition at line 344 of file ORMRow.php.

ORMRow::saveExisting ( functionName = null) [protected]

Updates the object in the database.

Since:
1.20
Deprecated:
since 1.22
Parameters:
string | null$functionName
Returns:
bool Success indicator

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.

Since:
1.20
Parameters:
string$name
mixed$value
Exceptions:
MWException

Implements IORMRow.

Definition at line 512 of file ORMRow.php.

ORMRow::setFields ( array fields,
override = true 
)

Sets multiple fields.

Since:
1.20
Parameters:
array$fieldsThe fields to set
bool$overrideOverride 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.

Since:
1.20
Parameters:
int | null$id

Implements IORMRow.

Definition at line 207 of file ORMRow.php.

ORMRow::setSummaryMode ( summaryMode)

Sets the value for the.

See also:
$inSummaryMode field.
Since:
1.20
Deprecated:
since 1.22
Parameters:
bool$summaryMode

Implements IORMRow.

Definition at line 574 of file ORMRow.php.

Sets the value for the.

See also:
$updateSummaries field.
Since:
1.20
Deprecated:
since 1.22
Parameters:
bool$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.

Since:
1.20
Parameters:
null | array$fields
bool$incNullId
Returns:
array

Implements IORMRow.

Definition at line 298 of file ORMRow.php.


Member Data Documentation

array ORMRow::$fields = array( 'id' => null ) [protected]

The fields of the object.

field name (w/o prefix) => value

Since:
1.20

Definition at line 41 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.

Deprecated:
since 1.22
Since:
1.20

Definition at line 62 of file ORMRow.php.

ORMTable null ORMRow::$table [protected]
Deprecated:
since 1.22
Since:
1.20

Definition at line 68 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.

Deprecated:
since 1.22
Since:
1.20

Definition at line 52 of file ORMRow.php.


The documentation for this class was generated from the following file: