Skip to content

Commit

Permalink
versioned table
Browse files Browse the repository at this point in the history
  • Loading branch information
azt3k committed Feb 7, 2016
1 parent 7f9e09a commit 07aaccb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/abc/code/Classes/DataObjectHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class DataObjectHelper{
class DataObjectHelper {

/*
* Stores a cache of the extension Map
Expand All @@ -15,6 +15,18 @@ protected static function db_dialect() {
return $databaseConfig['type'];
}

public static function versioned_table($className) {

$stagedRes = (
singleton($className)->hasExtension('Versioned') &&
strtolower(Versioned::current_stage()) != 'stage'
)
? $className . '_' . ucfirst(strtolower(Versioned::current_stage()))
: $className;

return $stagedRes;
}

/*
* Returns an array of classnames that have been extended with a Extension
*/
Expand Down

0 comments on commit 07aaccb

Please sign in to comment.