summaryrefslogtreecommitdiff
path: root/includes/db/ORMRow.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/db/ORMRow.php')
-rw-r--r--includes/db/ORMRow.php55
1 files changed, 27 insertions, 28 deletions
diff --git a/includes/db/ORMRow.php b/includes/db/ORMRow.php
index 5ce3794d..b0bade33 100644
--- a/includes/db/ORMRow.php
+++ b/includes/db/ORMRow.php
@@ -32,7 +32,6 @@
*/
class ORMRow implements IORMRow {
-
/**
* The fields of the object.
* field name (w/o prefix) => value
@@ -79,7 +78,7 @@ class ORMRow implements IORMRow {
*
* @param IORMTable|null $table Deprecated since 1.22
* @param array|null $fields
- * @param boolean $loadDefaults Deprecated since 1.22
+ * @param bool $loadDefaults Deprecated since 1.22
*/
public function __construct( IORMTable $table = null, $fields = null, $loadDefaults = false ) {
$this->table = $table;
@@ -102,8 +101,8 @@ class ORMRow implements IORMRow {
* @deprecated since 1.22
*
* @param array|null $fields
- * @param boolean $override
- * @param boolean $skipLoaded
+ * @param bool $override
+ * @param bool $skipLoaded
*
* @return bool Success indicator
*/
@@ -130,8 +129,10 @@ class ORMRow implements IORMRow {
if ( $result !== false ) {
$this->setFields( $this->table->getFieldsFromDBResult( $result ), $override );
+
return true;
}
+
return false;
}
@@ -144,7 +145,7 @@ class ORMRow implements IORMRow {
* @since 1.20
*
* @param string $name Field name
- * @param $default mixed: Default value to return when none is found
+ * @param mixed $default Default value to return when none is found
* (default: null)
*
* @throws MWException
@@ -166,7 +167,7 @@ class ORMRow implements IORMRow {
* @since 1.20
* @deprecated since 1.22
*
- * @param $name string
+ * @param string $name
*
* @return mixed
*/
@@ -194,7 +195,7 @@ class ORMRow implements IORMRow {
*
* @since 1.20
*
- * @return integer|null
+ * @return int|null
*/
public function getId() {
return $this->getField( 'id' );
@@ -205,7 +206,7 @@ class ORMRow implements IORMRow {
*
* @since 1.20
*
- * @param integer|null $id
+ * @param int|null $id
*/
public function setId( $id ) {
$this->setField( 'id', $id );
@@ -218,7 +219,7 @@ class ORMRow implements IORMRow {
*
* @param string $name
*
- * @return boolean
+ * @return bool
*/
public function hasField( $name ) {
return array_key_exists( $name, $this->fields );
@@ -229,11 +230,10 @@ class ORMRow implements IORMRow {
*
* @since 1.20
*
- * @return boolean
+ * @return bool
*/
public function hasIdField() {
- return $this->hasField( 'id' )
- && !is_null( $this->getField( 'id' ) );
+ return $this->hasField( 'id' ) && !is_null( $this->getField( 'id' ) );
}
/**
@@ -252,7 +252,7 @@ class ORMRow implements IORMRow {
$value = $this->fields[$name];
// Skip null id fields so that the DBMS can set the default.
- if ( $name === 'id' && is_null ( $value ) ) {
+ if ( $name === 'id' && is_null( $value ) ) {
continue;
}
@@ -278,7 +278,7 @@ class ORMRow implements IORMRow {
* @since 1.20
*
* @param array $fields The fields to set
- * @param boolean $override Override already set fields with the provided values?
+ * @param bool $override Override already set fields with the provided values?
*/
public function setFields( array $fields, $override = true ) {
foreach ( $fields as $name => $value ) {
@@ -295,7 +295,7 @@ class ORMRow implements IORMRow {
* @since 1.20
*
* @param null|array $fields
- * @param boolean $incNullId
+ * @param bool $incNullId
*
* @return array
*/
@@ -328,7 +328,7 @@ class ORMRow implements IORMRow {
* @since 1.20
* @deprecated since 1.22
*
- * @param boolean $override
+ * @param bool $override
*/
public function loadDefaults( $override = true ) {
$this->setFields( $this->table->getDefaults(), $override );
@@ -343,7 +343,7 @@ class ORMRow implements IORMRow {
*
* @param string|null $functionName
*
- * @return boolean Success indicator
+ * @return bool Success indicator
*/
public function save( $functionName = null ) {
if ( $this->hasIdField() ) {
@@ -361,7 +361,7 @@ class ORMRow implements IORMRow {
*
* @param string|null $functionName
*
- * @return boolean Success indicator
+ * @return bool Success indicator
*/
protected function saveExisting( $functionName = null ) {
$dbw = $this->table->getWriteDbConnection();
@@ -400,7 +400,7 @@ class ORMRow implements IORMRow {
* @param string|null $functionName
* @param array|null $options
*
- * @return boolean Success indicator
+ * @return bool Success indicator
*/
protected function insert( $functionName = null, array $options = null ) {
$dbw = $this->table->getWriteDbConnection();
@@ -430,7 +430,7 @@ class ORMRow implements IORMRow {
* @since 1.20
* @deprecated since 1.22, use IORMTable->removeRow
*
- * @return boolean Success indicator
+ * @return bool Success indicator
*/
public function remove() {
$this->beforeRemove();
@@ -456,8 +456,9 @@ class ORMRow implements IORMRow {
/**
* Before removal of an object happens, @see 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.
+ * 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
*
@@ -523,9 +524,9 @@ class ORMRow implements IORMRow {
* @deprecated since 1.22, use IORMTable->addToField
*
* @param string $field
- * @param integer $amount
+ * @param int $amount
*
- * @return boolean Success indicator
+ * @return bool Success indicator
*/
public function addToField( $field, $amount ) {
return $this->table->addToField( $this->getUpdateConditions(), $field, $amount );
@@ -552,7 +553,6 @@ class ORMRow implements IORMRow {
* @param array|string|null $summaryFields
*/
public function loadSummaryFields( $summaryFields = null ) {
-
}
/**
@@ -561,7 +561,7 @@ class ORMRow implements IORMRow {
* @since 1.20
* @deprecated since 1.22
*
- * @param boolean $update
+ * @param bool $update
*/
public function setUpdateSummaries( $update ) {
$this->updateSummaries = $update;
@@ -573,7 +573,7 @@ class ORMRow implements IORMRow {
* @since 1.20
* @deprecated since 1.22
*
- * @param boolean $summaryMode
+ * @param bool $summaryMode
*/
public function setSummaryMode( $summaryMode ) {
$this->inSummaryMode = $summaryMode;
@@ -590,5 +590,4 @@ class ORMRow implements IORMRow {
public function getTable() {
return $this->table;
}
-
}