MediaWiki
REL1_20
|
Public Member Functions | |
canHaveField ($name) | |
Gets if the object can take a certain field. | |
count (array $conditions=array(), array $options=array()) | |
Returns the amount of matching records. | |
delete (array $conditions, $functionName=null) | |
Removes the object from the database. | |
getAPIParams ($requireParams=false, $setDefaults=false) | |
Get API parameters for the fields supported by this object. | |
getDefaults () | |
Returns a list of default field values. | |
getFieldDescriptions () | |
Returns an array with the fields and their descriptions. | |
getFieldNames () | |
Return the names of the fields. | |
getFields () | |
Returns an array with the fields and their types this object contains. | |
getFieldsFromDBResult (stdClass $result) | |
Get an array with fields from a database result, that can be fed directly to the constructor or to setFields. | |
getName () | |
Returns the name of the database table objects of this type are stored in. | |
getPrefixedField ($field) | |
Takes in a field and returns an it's prefixed version, ready for db usage. | |
getPrefixedFields (array $fields) | |
Takes in a field or array of fields and returns an array with their prefixed versions, ready for db usage. | |
getPrefixedValues (array $values) | |
Takes in an associative array with field names as keys and their values as value. | |
getReadDb () | |
Get the database type used for read operations. | |
getRowClass () | |
Returns the name of a IORMRow implementing class that represents single rows in this table. | |
getSummaryFields () | |
Returns a list of the summary fields. | |
has (array $conditions=array()) | |
Returns if there is at least one record matching the provided conditions. | |
newRow (array $data, $loadDefaults=false) | |
Get a new instance of the class from an array. | |
newRowFromDBResult (stdClass $result) | |
Get a new instance of the class from a database result. | |
rawSelect ($fields=null, array $conditions=array(), array $options=array(), $functionName=null) | |
Do the actual select. | |
rawSelectRow (array $fields, array $conditions=array(), array $options=array(), $functionName=null) | |
Selects the the specified fields of the records matching the provided conditions. | |
select ($fields=null, array $conditions=array(), array $options=array(), $functionName=null) | |
Selects the the specified fields of the records matching the provided conditions and returns them as DBDataObject. | |
selectFields ($fields=null, array $conditions=array(), array $options=array(), $collapse=true, $functionName=null) | |
Selects the the specified fields of the records matching the provided conditions and returns them as associative arrays. | |
selectFieldsRow ($fields=null, array $conditions=array(), array $options=array(), $collapse=true, $functionName=null) | |
Selects the the specified fields of the first record matching the provided conditions and returns it as an associative array, or false when nothing matches. | |
selectObjects ($fields=null, array $conditions=array(), array $options=array(), $functionName=null) | |
Selects the the specified fields of the records matching the provided conditions and returns them as DBDataObject. | |
selectRow ($fields=null, array $conditions=array(), array $options=array(), $functionName=null) | |
Selects the the specified fields of the first matching record. | |
setReadDb ($db) | |
Set the database type to use for read operations. | |
unprefixFieldName ($fieldName) | |
Takes a field name with prefix and returns the unprefixed equivalent. | |
unprefixFieldNames (array $fieldNames) | |
Takes an array of field names with prefix and returns the unprefixed equivalent. | |
update (array $values, array $conditions=array()) | |
Update the records matching the provided conditions by setting the fields that are keys in the $values param to their corresponding values. | |
updateSummaryFields ($summaryFields=null, array $conditions=array()) | |
Computes the values of the summary fields of the objects matching the provided conditions. | |
Static Public Member Functions | |
static | singleton () |
Get an instance of this class. |
Definition at line 30 of file IORMTable.php.
IORMTable::canHaveField | ( | $ | name | ) |
Gets if the object can take a certain field.
string | $name |
Implemented in ORMTable.
IORMTable::count | ( | array $ | conditions = array() , |
array $ | options = array() |
||
) |
Returns the amount of matching records.
Condition field names get prefixed.
Note that this can be expensive on large tables. In such cases you might want to use DatabaseBase::estimateRowCount instead.
array | $conditions | |
array | $options |
Implemented in ORMTable.
IORMTable::delete | ( | array $ | conditions, |
$ | functionName = null |
||
) |
Removes the object from the database.
array | $conditions | |
string | null | $functionName |
Implemented in ORMTable.
IORMTable::getAPIParams | ( | $ | requireParams = false , |
$ | setDefaults = false |
||
) |
Get API parameters for the fields supported by this object.
boolean | $requireParams | |
boolean | $setDefaults |
Implemented in ORMTable.
Returns a list of default field values.
field name => field value
Implemented in ORMTable.
Returns an array with the fields and their descriptions.
field name => field description
Implemented in ORMTable.
Returns an array with the fields and their types this object contains.
This corresponds directly to the fields in the database, without prefix.
field name => type
Allowed types: * id * str * int * float * bool * array * blob
TODO: get rid of the id field. Every row instance needs to have one so this is just causing hassle at various locations by requiring an extra check for field name.
Implemented in TestORMTable.
IORMTable::getFieldsFromDBResult | ( | stdClass $ | result | ) |
Get an array with fields from a database result, that can be fed directly to the constructor or to setFields.
stdClass | $result |
Implemented in ORMTable.
Returns the name of the database table objects of this type are stored in.
Implemented in TestORMTable.
IORMTable::getPrefixedField | ( | $ | field | ) |
Takes in a field and returns an it's prefixed version, ready for db usage.
string | array | $field |
Implemented in ORMTable.
IORMTable::getPrefixedFields | ( | array $ | fields | ) |
Takes in a field or array of fields and returns an array with their prefixed versions, ready for db usage.
array | string | $fields |
Implemented in ORMTable.
IORMTable::getPrefixedValues | ( | array $ | values | ) |
Takes in an associative array with field names as keys and their values as value.
The field names are prefixed with the db field prefix.
array | $values |
Implemented in ORMTable.
Get the database type used for read operations.
Implemented in ORMTable.
Returns the name of a IORMRow implementing class that represents single rows in this table.
Implemented in TestORMTable.
Returns a list of the summary fields.
These are fields that cache computed values, such as the amount of linked objects of $type. This is relevant as one might not want to do actions such as log changes when these get updated.
Implemented in ORMTable.
IORMTable::has | ( | array $ | conditions = array() | ) |
Returns if there is at least one record matching the provided conditions.
Condition field names get prefixed.
array | $conditions |
Implemented in ORMTable.
IORMTable::newRow | ( | array $ | data, |
$ | loadDefaults = false |
||
) |
IORMTable::newRowFromDBResult | ( | stdClass $ | result | ) |
IORMTable::rawSelect | ( | $ | fields = null , |
array $ | conditions = array() , |
||
array $ | options = array() , |
||
$ | functionName = null |
||
) |
Do the actual select.
null | string | array | $fields | |
array | $conditions | |
array | $options | |
null | string | $functionName |
Implemented in ORMTable.
IORMTable::rawSelectRow | ( | array $ | fields, |
array $ | conditions = array() , |
||
array $ | options = array() , |
||
$ | functionName = null |
||
) |
Selects the the specified fields of the records matching the provided conditions.
Field names do NOT get prefixed.
array | $fields | |
array | $conditions | |
array | $options | |
string | null | $functionName |
Implemented in ORMTable.
IORMTable::select | ( | $ | fields = null , |
array $ | conditions = array() , |
||
array $ | options = array() , |
||
$ | functionName = null |
||
) |
IORMTable::selectFields | ( | $ | fields = null , |
array $ | conditions = array() , |
||
array $ | options = array() , |
||
$ | collapse = true , |
||
$ | functionName = null |
||
) |
Selects the the specified fields of the records matching the provided conditions and returns them as associative arrays.
Provided field names get prefixed. Returned field names will not have a prefix.
When $collapse is true: If one field is selected, each item in the result array will be this field. If two fields are selected, each item in the result array will have as key the first field and as value the second field. If more then two fields are selected, each item will be an associative array.
array | string | null | $fields | |
array | $conditions | |
array | $options | |
boolean | $collapse | Set to false to always return each result row as associative array. |
string | null | $functionName |
Implemented in ORMTable.
IORMTable::selectFieldsRow | ( | $ | fields = null , |
array $ | conditions = array() , |
||
array $ | options = array() , |
||
$ | collapse = true , |
||
$ | functionName = null |
||
) |
Selects the the specified fields of the first record matching the provided conditions and returns it as an associative array, or false when nothing matches.
This method makes use of selectFields and expects the same parameters and returns the same results (if there are any, if there are none, this method returns false).
array | string | null | $fields | |
array | $conditions | |
array | $options | |
boolean | $collapse | Set to false to always return each result row as associative array. |
string | null | $functionName |
Implemented in ORMTable.
IORMTable::selectObjects | ( | $ | fields = null , |
array $ | conditions = array() , |
||
array $ | options = array() , |
||
$ | functionName = null |
||
) |
IORMTable::selectRow | ( | $ | fields = null , |
array $ | conditions = array() , |
||
array $ | options = array() , |
||
$ | functionName = null |
||
) |
IORMTable::setReadDb | ( | $ | db | ) |
Set the database type to use for read operations.
integer | $db |
Implemented in ORMTable.
static IORMTable::singleton | ( | ) | [static] |
IORMTable::unprefixFieldName | ( | $ | fieldName | ) |
Takes a field name with prefix and returns the unprefixed equivalent.
string | $fieldName |
Implemented in ORMTable.
IORMTable::unprefixFieldNames | ( | array $ | fieldNames | ) |
Takes an array of field names with prefix and returns the unprefixed equivalent.
array | $fieldNames |
Implemented in ORMTable.
IORMTable::update | ( | array $ | values, |
array $ | conditions = array() |
||
) |
Update the records matching the provided conditions by setting the fields that are keys in the $values param to their corresponding values.
array | $values | |
array | $conditions |
Implemented in ORMTable.
IORMTable::updateSummaryFields | ( | $ | summaryFields = null , |
array $ | conditions = array() |
||
) |
Computes the values of the summary fields of the objects matching the provided conditions.
array | string | null | $summaryFields | |
array | $conditions |
Implemented in ORMTable.