In the future this opens up an easy posibility of subclassing
if this is made protected.
Change-Id: I640c9f12f52dbb3328523402d9223ee8c967adda
$dbw = $this->getDBConnection( DB_MASTER );
- $insertFields = [ $this->nameField => $name ];
- if ( $this->insertCallback !== null ) {
- $insertFields = call_user_func( $this->insertCallback, $insertFields );
- }
-
$dbw->insert(
$this->table,
- $insertFields,
+ $this->getFieldsToStore( $name ),
__METHOD__,
[ 'IGNORE' ]
);
return $dbw->insertId();
}
+ /**
+ * @param string $name
+ * @return array
+ */
+ private function getFieldsToStore( $name ) {
+ $fields = [ $this->nameField => $name ];
+ if ( $this->insertCallback !== null ) {
+ $fields = call_user_func( $this->insertCallback, $fields );
+ }
+ return $fields;
+ }
+
}