Skip to content

Commit

Permalink
added method to Gdn_Model: OverrideDatabasePrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Wright committed Jul 6, 2010
1 parent a80d0cc commit a2355a9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions library/core/class.model.php
Expand Up @@ -405,6 +405,22 @@ public function SaveToSerializedColumn($Column, $RowID, $Name, $Value = '') {
->Set($Column, $Values)
->Put();
}

/**
* Overrides the database prefix for this specific model as opposed to the one used in the config.
* Can be called after the model's __construct()
*
* @param string $NewPrefix
* @return void
* @todo refactor
*/
public function OverrideDatabasePrefix($NewPrefix) {
$this->Database = clone $this->Database;
$this->Database->DatabasePrefix = $NewPrefix;
$this->SQL = clone $this->SQL;
$this->SQL->Database = $this->Database;
}

}

?>

2 comments on commit a2355a9

@tburry
Copy link

@tburry tburry commented on a2355a9 Jan 7, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you sign the contributors agreement at http://vanillaforums.org/contributors? Thanks!

@fabrikagency
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed!

Please sign in to comment.