* The fields of the object.
* field name (w/o prefix) => value
*
- * @since 0.1
+ * @since 1.20
* @var array
*/
protected $fields = array( 'id' => null );
* Settings this to false can prevent needless updating work in situations
* such as deleting a university, which will then delete all it's courses.
*
- * @since 0.1
+ * @since 1.20
* @var bool
*/
protected $updateSummaries = true;
* This mode indicates that only summary fields got updated,
* which allows for optimizations.
*
- * @since 0.1
+ * @since 1.20
* @var bool
*/
protected $inSummaryMode = false;
/**
* Returns the name of the database table objects of this type are stored in.
*
- * @since 0.1
+ * @since 1.20
*
* @throws MWException
* @return string
/**
* Gets the db field prefix.
*
- * @since 0.1
+ * @since 1.20
*
* @throws MWException
* @return string
* * bool
* * array
*
- * @since 0.1
+ * @since 1.20
*
* @throws MWException
* @return array
* Returns a list of default field values.
* field name => field value
*
- * @since 0.1
+ * @since 1.20
*
* @return array
*/
* 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.
*
- * @since 0.1
+ * @since 1.20
*
* @return array
*/
/**
* Constructor.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|null $fields
* @param boolean $loadDefaults
/**
* Load the specified fields from the database.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|null $fields
* @param boolean $override
/**
* Gets the value of a field.
*
- * @since 0.1
+ * @since 1.20
*
* @param string $name
* @param mixed $default
/**
* Gets the value of a field but first loads it if not done so already.
*
- * @since 0.1
+ * @since 1.20
*
* @param string$name
*
/**
* Remove a field.
*
- * @since 0.1
+ * @since 1.20
*
* @param string $name
*/
/**
* Returns the objects database id.
*
- * @since 0.1
+ * @since 1.20
*
* @return integer|null
*/
/**
* Sets the objects database id.
*
- * @since 0.1
+ * @since 1.20
*
* @param integer|null $id
*/
/**
* Gets if a certain field is set.
*
- * @since 0.1
+ * @since 1.20
*
* @param string $name
*
/**
* Gets if the id field is set.
*
- * @since 0.1
+ * @since 1.20
*
* @return boolean
*/
/**
* Sets multiple fields.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $fields The fields to set
* @param boolean $override Override already set fields with the provided values?
/**
* Gets the fields => values to write to the table.
*
- * @since 0.1
+ * @since 1.20
*
* @return array
*/
* Serializes the object to an associative array which
* can then easily be converted into JSON or similar.
*
- * @since 0.1
+ * @since 1.20
*
* @param null|array $fields
* @param boolean $incNullId
/**
* Load the default values, via getDefaults.
*
- * @since 0.1
+ * @since 1.20
*
* @param boolean $override
*/
* Writes the answer to the database, either updating it
* when it already exists, or inserting it when it doesn't.
*
- * @since 0.1
+ * @since 1.20
*
* @return boolean Success indicator
*/
/**
* Updates the object in the database.
*
- * @since 0.1
+ * @since 1.20
*
* @return boolean Success indicator
*/
/**
* Inserts the object into the database.
*
- * @since 0.1
+ * @since 1.20
*
* @return boolean Success indicator
*/
/**
* Removes the object from the database.
*
- * @since 0.1
+ * @since 1.20
*
* @return boolean Success indicator
*/
/**
* Gets called before an object is removed from the database.
*
- * @since 0.1
+ * @since 1.20
*/
protected function beforeRemove() {
$this->loadFields( $this->getBeforeRemoveFields(), false, true );
* 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 0.1
+ * @since 1.20
*
* @return array|null
*/
* Gets called after successfull removal.
* Can be overriden to get rid of linked data.
*
- * @since 0.1
+ * @since 1.20
*/
protected function onRemoved() {
$this->setField( 'id', null );
/**
* Return the names and values of the fields.
*
- * @since 0.1
+ * @since 1.20
*
* @return array
*/
/**
* Return the names of the fields.
*
- * @since 0.1
+ * @since 1.20
*
* @return array
*/
* Strings can be provided for other types,
* so this method can be called from unserialization handlers.
*
- * @since 0.1
+ * @since 1.20
*
* @param string $name
* @param mixed $value
/**
* Get a new instance of the class from an array.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $data
* @param boolean $loadDefaults
/**
* Gets if the object can take a certain field.
*
- * @since 0.1
+ * @since 1.20
*
* @param string $name
*
* Takes in a field or array of fields and returns an
* array with their prefixed versions, ready for db usage.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|string $fields
*
* array( 'tablename', 'fieldname' )
* Where table name is registered in $wgDBDataObjects.
*
- * @since 0.1
+ * @since 1.20
*
* @param string|array $field
*
* array( array( 'tablename', 'fieldname' ), $value ),
* );
*
- * @since 0.1
+ * @since 1.20
*
* @param array $values
*
* that can be fed directly to the constructor or
* to setFields.
*
- * @since 0.1
+ * @since 1.20
*
* @param object $result
*
/**
* Takes a field name with prefix and returns the unprefixed equivalent.
*
- * @since 0.1
+ * @since 1.20
*
* @param string $fieldName
*
/**
* Takes an array of field names with prefix and returns the unprefixed equivalent.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $fieldNames
*
/**
* Get a new instance of the class from a database result.
*
- * @since 0.1
+ * @since 1.20
*
* @param stdClass $result
*
/**
* Removes the object from the database.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $conditions
*
/**
* Add an amount (can be negative) to the specified field (needs to be numeric).
*
- * @since 0.1
+ * @since 1.20
*
* @param string $field
* @param integer $amount
* Selects the the specified fields of the records matching the provided
* conditions and returns them as DBDataObject. Field names get prefixed.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|string|null $fields
* @param array $conditions
* the first field and as value the second field.
* If more then two fields are selected, each item will be an associative array.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|string|null $fields
* @param array $conditions
* Process the join conditions. This includes prefixing table and field names,
* and adding of needed tables.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $joinConds Join conditions without prefixes and fields in array rather then string with equals sign.
* @param array $tables List of tables to which the extra needed ones get added.
* Selects the the specified fields of the first matching record.
* Field names get prefixed.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|string|null $fields
* @param array $conditions
* returns the same results (if there are any, if there are none, this method returns false).
* @see DBDataObject::selectFields
*
- * @since 0.1
+ * @since 1.20
*
* @param array|string|null $fields
* @param array $conditions
* Returns if there is at least one record matching the provided conditions.
* Condition field names get prefixed.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $conditions
*
* Returns the amount of matching records.
* Condition field names get prefixed.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $conditions
* @param array $options
* Selects the the specified fields of the records matching the provided
* conditions. Field names do NOT get prefixed.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $fields
* @param array $conditions
* setting the fields that are keys in the $values param to
* their corresponding values.
*
- * @since 0.1
+ * @since 1.20
*
* @param array $values
* @param array $conditions
/**
* Return the names of the fields.
*
- * @since 0.1
+ * @since 1.20
*
* @return array
*/
*
* field name => field description
*
- * @since 0.1
+ * @since 1.20
*
* @return array
*/
/**
* Get API parameters for the fields supported by this object.
*
- * @since 0.1
+ * @since 1.20
*
* @param boolean $requireParams
* @param boolean $setDefaults
/**
* Computes and updates the values of the summary fields.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|string|null $summaryFields
*/
/**
* Computes the values of the summary fields of the objects matching the provided conditions.
*
- * @since 0.1
+ * @since 1.20
*
* @param array|string|null $summaryFields
* @param array $conditions
/**
* Sets the value for the @see $updateSummaries field.
*
- * @since 0.1
+ * @since 1.20
*
* @param boolean $update
*/
/**
* Sets the value for the @see $inSummaryMode field.
*
- * @since 0.1
+ * @since 1.20
*
* @param boolean $update
*/
/**
* Return if any fields got changed.
*
- * @since 0.1
+ * @since 1.20
*
* @param DBDataObject $object
* @param boolean $excludeSummaryFields When set to true, summary field changes are ignored.