Jelajahi Sumber

Fixing my stupid mistake

Stephen Ficklin 9 tahun lalu
induk
melakukan
0e7518c058
1 mengubah file dengan 15 tambahan dan 13 penghapusan
  1. 15 13
      tripal_core/api/tripal_core.chado_nodes.title_and_path.inc

+ 15 - 13
tripal_core/api/tripal_core.chado_nodes.title_and_path.inc

@@ -1268,20 +1268,22 @@ function chado_node_generate_tokens($base_table, $token_prefix = FALSE, $locatio
 
   // RECURSION:
   // Follow the foreign key relationships recursively
-  foreach (array_key_exists('foreign keys', $table_descrip) and $table_descrip['foreign keys'] as $table => $details) {
-    foreach ($details['columns'] as $left_field => $right_field) {
-      if (empty($token_prefix)) {
-        $sub_token_prefix = $base_table . '.' . $left_field;
-        $sub_location_prefix = implode(' > ',array($base_table, $left_field));
-      }
-      else {
-        $sub_token_prefix = $token_prefix . '>' . $base_table . ':' . $left_field;
-        $sub_location_prefix = $location_prefix . ' > ' . implode(' > ',array($base_table, $left_field));
-      }
+  if (array_key_exists('foreign keys', $table_descrip)) {
+    foreach ($table_descrip['foreign keys'] as $table => $details) {
+      foreach ($details['columns'] as $left_field => $right_field) {
+        if (empty($token_prefix)) {
+          $sub_token_prefix = $base_table . '.' . $left_field;
+          $sub_location_prefix = implode(' > ',array($base_table, $left_field));
+        }
+        else {
+          $sub_token_prefix = $token_prefix . '>' . $base_table . ':' . $left_field;
+          $sub_location_prefix = $location_prefix . ' > ' . implode(' > ',array($base_table, $left_field));
+        }
 
-      $sub_tokens = chado_node_generate_tokens($table, $sub_token_prefix, $sub_location_prefix);
-      if (is_array($sub_tokens)) {
-        $tokens = array_merge($tokens, $sub_tokens);
+        $sub_tokens = chado_node_generate_tokens($table, $sub_token_prefix, $sub_location_prefix);
+        if (is_array($sub_tokens)) {
+          $tokens = array_merge($tokens, $sub_tokens);
+        }
       }
     }
   }