Merge "mw.loader: Fixes for <script> and <link> loading."
[lhc/web/wiklou.git] / includes / db / ORMRow.php
index 6f19fe1..1753afe 100644 (file)
@@ -5,6 +5,8 @@
  * aims to be both simple and very flexible. It is centered around an associative
  * array of fields and various methods to do common interaction with the database.
  *
+ * Documentation inline and at https://www.mediawiki.org/wiki/Manual:ORMTable
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -25,7 +27,7 @@
  * @file ORMRow.php
  * @ingroup ORM
  *
- * @licence GNU GPL v2 or later
+ * @license GNU GPL v2 or later
  * @author Jeroen De Dauw < jeroendedauw@gmail.com >
  */
 
@@ -136,8 +138,9 @@ abstract class ORMRow implements IORMRow {
         *
         * @since 1.20
         *
-        * @param string $name
-        * @param mixed $default
+        * @param $name string: Field name
+        * @param $default mixed: Default value to return when none is found
+        * (default: null)
         *
         * @throws MWException
         * @return mixed
@@ -157,7 +160,7 @@ abstract class ORMRow implements IORMRow {
         *
         * @since 1.20
         *
-        * @param string$name
+        * @param $name string
         *
         * @return mixed
         */
@@ -344,7 +347,7 @@ abstract class ORMRow implements IORMRow {
         * @return boolean Success indicator
         */
        protected function saveExisting( $functionName = null ) {
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->table->getWriteDbConnection();
 
                $success = $dbw->update(
                        $this->table->getName(),
@@ -380,7 +383,7 @@ abstract class ORMRow implements IORMRow {
         * @return boolean Success indicator
         */
        protected function insert( $functionName = null, array $options = null ) {
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->table->getWriteDbConnection();
 
                $success = $dbw->insert(
                        $this->table->getName(),
@@ -555,7 +558,7 @@ abstract class ORMRow implements IORMRow {
                $absoluteAmount = abs( $amount );
                $isNegative = $amount < 0;
 
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->table->getWriteDbConnection();
 
                $fullField = $this->table->getPrefixedField( $field );