Browse Source

Removed hardcoded chado and public schemas

Stephen Ficklin 5 years ago
parent
commit
bdf97b0042
1 changed files with 6 additions and 2 deletions
  1. 6 2
      tripal_chado/includes/ChadoPrefixExtender.inc

+ 6 - 2
tripal_chado/includes/ChadoPrefixExtender.inc

@@ -204,15 +204,18 @@ class ChadoPrefixExtender extends SelectQueryExtender {
    *
    */
   public static function getTable($table) {
+    $chado_schema_name = chado_get_schema_name('chado');
+    $drupal_schema_name = chado_get_schema_name('drupal');
+
     // No schema was provided.
     if (strpos($table, '.') === FALSE) {
       // If this is a chado table, add the chado prefix. Otherwise, add the
       // public prefix.
       if (static::isChadoTable($table)) {
-        $table = "chado.{$table}";
+        $table = $chado_schema_name . ".{$table}";
       }
       else {
-        $table = "public.{$table}";
+        $table = $drupal_schema_name . ".{$table}";
       }
     }
 
@@ -234,6 +237,7 @@ class ChadoPrefixExtender extends SelectQueryExtender {
    *    The table name with the correct prefix.
    */
   public static function getRealSchema($table) {
+
     if (strpos($table, 'public.') === 0) {
       $replace = chado_get_schema_name('drupal') . '.';
       return str_replace('public.', $replace, $table);