瀏覽代碼

Fixed bug in loading field values

Stephen Ficklin 8 年之前
父節點
當前提交
32b56a6357
共有 25 個文件被更改,包括 306 次插入78 次删除
  1. 1 1
      tripal/includes/TripalField.inc
  2. 3 2
      tripal/includes/fields/content_type.inc
  3. 3 4
      tripal/includes/tripal.field_storage.inc
  4. 16 3
      tripal_chado/includes/fields/chado_base__dbxref_id.inc
  5. 16 3
      tripal_chado/includes/fields/chado_base__organism_id.inc
  6. 16 2
      tripal_chado/includes/fields/chado_feature__md5checksum.inc
  7. 22 7
      tripal_chado/includes/fields/chado_feature__residues.inc
  8. 16 2
      tripal_chado/includes/fields/chado_feature__seqlen.inc
  9. 18 3
      tripal_chado/includes/fields/chado_gene__transcripts.inc
  10. 17 3
      tripal_chado/includes/fields/chado_linker__contact.inc
  11. 1 1
      tripal_chado/includes/fields/chado_linker__cvterm.inc
  12. 16 2
      tripal_chado/includes/fields/chado_linker__cvterm_adder.inc
  13. 15 3
      tripal_chado/includes/fields/chado_linker__dbxref.inc
  14. 15 3
      tripal_chado/includes/fields/chado_linker__expression.inc
  15. 18 4
      tripal_chado/includes/fields/chado_linker__featureloc.inc
  16. 15 3
      tripal_chado/includes/fields/chado_linker__genotype.inc
  17. 16 3
      tripal_chado/includes/fields/chado_linker__phenotype.inc
  18. 1 1
      tripal_chado/includes/fields/chado_linker__prop.inc
  19. 14 2
      tripal_chado/includes/fields/chado_linker__prop_adder.inc
  20. 15 3
      tripal_chado/includes/fields/chado_linker__pub.inc
  21. 17 4
      tripal_chado/includes/fields/chado_linker__relationship.inc
  22. 15 3
      tripal_chado/includes/fields/chado_linker__synonym.inc
  23. 15 3
      tripal_chado/includes/fields/chado_organism__type_id.inc
  24. 3 13
      tripal_chado/includes/tripal_chado.field_storage.inc
  25. 2 0
      tripal_chado/includes/tripal_chado.fields.inc

+ 1 - 1
tripal/includes/TripalField.inc

@@ -585,7 +585,7 @@ class TripalField {
    *
    *
    */
-  public function load($field, $entity, $details) {
+  public static function load($field, $entity, $details = array()) {
 
   }
 

+ 3 - 2
tripal/includes/fields/content_type.inc

@@ -114,9 +114,10 @@ class content_type extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
-    $entity->{$this->field_name}['und'][0]['value'] = $this->bundle->label;
+    $bundle = tripal_load_bundle_entity(array('name' => $entity->bundle));
+    $entity->{$field['field_name']}['und'][0]['value'] = $bundle->label;
   }
 
   /**

+ 3 - 4
tripal/includes/tripal.field_storage.inc

@@ -50,11 +50,10 @@ function tripal_field_storage_load($entity_type, $entities, $age,
 
       // Allow the creating module to alter the value if desired.  The
       // module should do this if the field has any other form elements
-      // that need populationg besides the default value.
-      $load_function = $field_module . '_' . $field_type . '_field_load';
+      // that need populationg besides the value which was set above.
       module_load_include('inc', $field_module, 'includes/fields/' . $field_type);
-      if (function_exists($load_function)) {
-        $load_function($field, $entity);
+      if (class_exists($field_type)) {
+        $field_type::load($field, $entity);
       }
 
     } // end: foreach ($fields as $field_id => $ids) {

+ 16 - 3
tripal_chado/includes/fields/chado_base__dbxref_id.inc

@@ -44,6 +44,19 @@ class chado_base__dbxref_id extends TripalField {
     $this->can_attach = FALSE;
   }
 
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '__dbxref_id';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -59,7 +72,7 @@ class chado_base__dbxref_id extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__dbxref_id',
+      'field_name' => $this->field_name,
       'type' => 'chado_base__dbxref_id',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -88,7 +101,7 @@ class chado_base__dbxref_id extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__dbxref_id',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Accession',
@@ -295,7 +308,7 @@ class chado_base__dbxref_id extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $record = $details['record'];
 

+ 16 - 3
tripal_chado/includes/fields/chado_base__organism_id.inc

@@ -55,6 +55,19 @@ class chado_base__organism_id extends TripalField {
     $this->can_attach = FALSE;
   }
 
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '__organism_id';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -71,7 +84,7 @@ class chado_base__organism_id extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__organism_id',
+      'field_name' => $this->field_name,
       'type' => 'chado_base__organism_id',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -108,7 +121,7 @@ class chado_base__organism_id extends TripalField {
     }
 
     return array(
-      'field_name' => $table_name . '__organism_id',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Organism',
@@ -217,7 +230,7 @@ class chado_base__organism_id extends TripalField {
   /**
    * @see TripalField::load()
    */
-  public function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $record = $details['record'];
     $settings = $field['settings'];

+ 16 - 2
tripal_chado/includes/fields/chado_feature__md5checksum.inc

@@ -35,6 +35,20 @@ class chado_feature__md5checksum  extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '__md5checksum';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -50,7 +64,7 @@ class chado_feature__md5checksum  extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__md5checksum',
+      'field_name' => $this->field_name,
       'type' => 'chado_feature__md5checksum',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -79,7 +93,7 @@ class chado_feature__md5checksum  extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__md5checksum',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Sequence Checksum',

+ 22 - 7
tripal_chado/includes/fields/chado_feature__residues.inc

@@ -37,6 +37,20 @@ class chado_feature__residues extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = 'feature__residues';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -52,7 +66,7 @@ class chado_feature__residues extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'feature__residues',
+      'field_name' => $this->field_name,
       'type' => 'chado_feature__residues',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -80,7 +94,7 @@ class chado_feature__residues extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'feature__residues',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Sequences',
@@ -199,7 +213,8 @@ class chado_feature__residues extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
+
     $field_name = $field['field_name'];
     $feature = $details['record'];
     $num_seqs = 0;
@@ -287,7 +302,7 @@ class chado_feature__residues extends TripalField {
     );
     $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
 
-    $featureloc_sequences = $this->get_featureloc_sequences($feature->feature_id, $feature->featureloc->feature_id);
+    $featureloc_sequences = self::get_featureloc_sequences($feature->feature_id, $feature->featureloc->feature_id);
 
     // Add in the coding sequences.
     $values = array(
@@ -391,7 +406,7 @@ class chado_feature__residues extends TripalField {
 
     // get the list of relationships (including any aggregators) and iterate
     // through each one to find information needed to color-code the reference sequence
-    $relationships = $this->get_aggregate_relationships($feature_id);
+    $relationships = self::get_aggregate_relationships($feature_id);
     if (!$relationships) {
       return array();
     }
@@ -401,7 +416,7 @@ class chado_feature__residues extends TripalField {
     // locations
     foreach ($relationships as $rindex => $rel) {
       // get the featurelocs for each of the relationship features
-      $rel_featurelocs = $this->get_featurelocs($rel->subject_id, 'as_child', 0);
+      $rel_featurelocs = self::get_featurelocs($rel->subject_id, 'as_child', 0);
       foreach ($rel_featurelocs as $rfindex => $rel_featureloc) {
         // keep track of this unique source feature
         $src = $rel_featureloc->src_feature_id . "-" . $rel_featureloc->src_cvterm_id;
@@ -537,7 +552,7 @@ class chado_feature__residues extends TripalField {
     }
 
     // first get the relationships for this feature
-    return $this->get_relationships($feature_id, 'as_object');
+    return self::get_relationships($feature_id, 'as_object');
 
   }
 

+ 16 - 2
tripal_chado/includes/fields/chado_feature__seqlen.inc

@@ -35,6 +35,20 @@ class chado_feature__seqlen extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = 'feature__seqlen';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -49,7 +63,7 @@ class chado_feature__seqlen extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'feature__seqlen',
+      'field_name' => $this->field_name,
       'type' => 'chado_feature__seqlen',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -77,7 +91,7 @@ class chado_feature__seqlen extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'feature__seqlen',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Raw Sequence Length',

+ 18 - 3
tripal_chado/includes/fields/chado_gene__transcripts.inc

@@ -37,6 +37,20 @@ class chado_gene__transcripts extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = 'gene_transcripts';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -55,7 +69,7 @@ class chado_gene__transcripts extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => 'gene_transcripts',
+      'field_name' => $this->field_name,
       'type' => 'chado_gene__transcripts',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -85,7 +99,7 @@ class chado_gene__transcripts extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'gene_transcripts',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Transcripts',
@@ -211,7 +225,8 @@ class chado_gene__transcripts extends TripalField {
   /**
    * @see TripalField::load()
    */
-  public function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
+
     $record = $details['record'];
 
     $field_name = $field['field_name'];

+ 17 - 3
tripal_chado/includes/fields/chado_linker__contact.inc

@@ -39,6 +39,19 @@ class chado_linker__contact extends TripalField {
     $this->can_attach = FALSE;
   }
 
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_contact';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -58,7 +71,7 @@ class chado_linker__contact extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => $contact_table,
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__contact',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -89,7 +102,7 @@ class chado_linker__contact extends TripalField {
     $contact_table = $table_name . '_contact';
 
     return array(
-      'field_name' => $contact_table,
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Contacts',
@@ -208,7 +221,8 @@ class chado_linker__contact extends TripalField {
   /**
    * @see TripalField::load()
    */
-  public function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
+
     $record = $details['record'];
     $field_name = $field['field_name'];
     $field_type = $field['type'];

+ 1 - 1
tripal_chado/includes/fields/chado_linker__cvterm.inc

@@ -254,7 +254,7 @@ class chado_linker__cvterm extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $record = $details['record'];
 

+ 16 - 2
tripal_chado/includes/fields/chado_linker__cvterm_adder.inc

@@ -40,6 +40,20 @@ class chado_linker__cvterm_addr extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_cvterm';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -55,7 +69,7 @@ class chado_linker__cvterm_addr extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '_cvterm',
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__cvterm_adder',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -80,7 +94,7 @@ class chado_linker__cvterm_addr extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '_cvterm',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Add Annotation Types',

+ 15 - 3
tripal_chado/includes/fields/chado_linker__dbxref.inc

@@ -50,6 +50,18 @@ class chado_linker__dbxref extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_dbxref';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -68,7 +80,7 @@ class chado_linker__dbxref extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => $dbxref_table,
+      'field_name' =>  $this->field_name,
       'type' => 'chado_linker__dbxref',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -99,7 +111,7 @@ class chado_linker__dbxref extends TripalField {
 
     $dbxref_table = $table_name . '_dbxref';
     return array(
-      'field_name' => $dbxref_table,
+      'field_name' =>  $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Cross References',
@@ -311,7 +323,7 @@ class chado_linker__dbxref extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $record = $details['record'];
 

+ 15 - 3
tripal_chado/includes/fields/chado_linker__expression.inc

@@ -38,6 +38,18 @@ class chado_linker__expression extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_expression';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -56,7 +68,7 @@ class chado_linker__expression extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => $table_name . '_expression',
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__expression',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -86,7 +98,7 @@ class chado_linker__expression extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '_expression',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Expression',
@@ -216,7 +228,7 @@ class chado_linker__expression extends TripalField {
   /**
    * @see TripalField::load()
    */
-  public function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
     $record = $details['record'];
 
     $field_name = $field['field_name'];

+ 18 - 4
tripal_chado/includes/fields/chado_linker__featureloc.inc

@@ -36,6 +36,20 @@ class chado_linker__featureloc extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = 'featureloc';
+  }
+
   /**
    * @see TripalField::create_info()
    */
@@ -53,7 +67,7 @@ class chado_linker__featureloc extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => 'featureloc',
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__featureloc',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -83,7 +97,7 @@ class chado_linker__featureloc extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'featureloc',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Aligned Locations',
@@ -234,7 +248,7 @@ class chado_linker__featureloc extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
     $record = $details['record'];
     $settings = $field['settings'];
 
@@ -271,7 +285,7 @@ class chado_linker__featureloc extends TripalField {
     }
 
     // Get matched alignments (those with an itermediate 'match' or 'EST_match', etc
-    $mfeaturelocs = $this->get_matched_alignments($feature);
+    $mfeaturelocs = self::get_matched_alignments($feature);
     $feature->matched_featurelocs = $mfeaturelocs;
 
     // Combine all three alignments into a single array for printing together in

+ 15 - 3
tripal_chado/includes/fields/chado_linker__genotype.inc

@@ -63,6 +63,18 @@ class chado_linker__genotype extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_genotype';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -81,7 +93,7 @@ class chado_linker__genotype extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => $table_name . '__genotype',
+      'field_name' => $this->field_name,
       'type' => 'chado_feature__md5checksum',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -111,7 +123,7 @@ class chado_linker__genotype extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__genotype',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Genotypes',
@@ -203,7 +215,7 @@ class chado_linker__genotype extends TripalField {
   /**
    * @see TripalField::load()
    */
-  public function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
     $record = $details['record'];
     $field_name = $field['field_name'];
     $field_type = $field['type'];

+ 16 - 3
tripal_chado/includes/fields/chado_linker__phenotype.inc

@@ -63,6 +63,18 @@ class chado_linker__phenotype extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_phenotype';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -81,7 +93,7 @@ class chado_linker__phenotype extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => $table_name . '__phenotype',
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__phenotype',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -111,7 +123,7 @@ class chado_linker__phenotype extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__phenotype',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Phenotypes',
@@ -203,7 +215,8 @@ class chado_linker__phenotype extends TripalField {
   /**
    * @see TripalField::load()
    */
-  public function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
+
     $record = $details['record'];
     $field_name = $field['field_name'];
     $field_type = $field['type'];

+ 1 - 1
tripal_chado/includes/fields/chado_linker__prop.inc

@@ -229,7 +229,7 @@ class chado_linker__prop extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $field_name = $details['field_name'];
     $field_type = $details['type'];

+ 14 - 2
tripal_chado/includes/fields/chado_linker__prop_adder.inc

@@ -38,6 +38,18 @@ class chado_linker__prop_adder extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . 'prop';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -54,7 +66,7 @@ class chado_linker__prop_adder extends TripalField {
 
     $prop_table = $table_name . 'prop';
     return array(
-      'field_name' => $prop_table,
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__prop_adder',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -81,7 +93,7 @@ class chado_linker__prop_adder extends TripalField {
 
     $prop_table = $table_name . 'prop';
     return array(
-      'field_name' => $prop_table,
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Add Properties',

+ 15 - 3
tripal_chado/includes/fields/chado_linker__pub.inc

@@ -37,6 +37,18 @@ class chado_linker_pub extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_pub';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -55,7 +67,7 @@ class chado_linker_pub extends TripalField {
     $schema = chado_get_schema($pub_table);
     $pkey = $schema['primary key'][0];
     return array(
-      'field_name' => $table_name . '__pub',
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__pub',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -85,7 +97,7 @@ class chado_linker_pub extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '__pub',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Publications',
@@ -251,7 +263,7 @@ class chado_linker_pub extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $record = $details['record'];
 

+ 17 - 4
tripal_chado/includes/fields/chado_linker__relationship.inc

@@ -36,6 +36,18 @@ class chado_linker__relationship extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_relationship';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -53,7 +65,7 @@ class chado_linker__relationship extends TripalField {
     $schema = chado_get_schema($rel_table);
     $pkey = $schema['primary key'][0];
     return array(
-      'field_name' => $table_name . '_relationship',
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__relationship',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -83,7 +95,7 @@ class chado_linker__relationship extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '_relationship',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Relationships',
@@ -557,7 +569,8 @@ class chado_linker__relationship extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
+
     $settings = $field['settings'];
 
     $record = $details['record'];
@@ -654,7 +667,7 @@ class chado_linker__relationship extends TripalField {
       foreach ($orelationships as $relationship) {
         $rel_acc = $relationship->type_id->dbxref_id->db_id->name . ':' . $relationship->type_id->dbxref_id->accession;
         $rel_type = $relationship->type_id->name;
-        $verb = $this->get_rel_verb($rel_type);
+        $verb = self::get_rel_verb($rel_type);
         $subject_name = $relationship->subject_id->name;
         $subject_type = $relationship->subject_id->type_id->name;
         $object_name = $relationship->object_id->name;

+ 15 - 3
tripal_chado/includes/fields/chado_linker__synonym.inc

@@ -37,6 +37,18 @@ class chado_linker__synonym extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = $table_name . '_synonym';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -56,7 +68,7 @@ class chado_linker__synonym extends TripalField {
     $pkey = $schema['primary key'][0];
 
     return array(
-      'field_name' => $table_name . '_synonym',
+      'field_name' => $this->field_name,
       'type' => 'chado_linker__synonym',
       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
       'locked' => FALSE,
@@ -86,7 +98,7 @@ class chado_linker__synonym extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => $table_name . '_synonym',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Synonyms',
@@ -272,7 +284,7 @@ class chado_linker__synonym extends TripalField {
   /**
    * @see TripalField::load()
    */
-  function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $record = $details['record'];
     $base_table = $field['settings']['base_table'];

+ 15 - 3
tripal_chado/includes/fields/chado_organism__type_id.inc

@@ -39,6 +39,18 @@ class chado_organism__type_id extends TripalField {
     }
     $this->can_attach = FALSE;
   }
+  /**
+   * @see TripalField::setFieldName()
+   */
+  protected function setFieldName() {
+    $table_name = $this->details['chado_table'];
+    $type_table = $this->details['chado_type_table'];
+    $type_field = $this->details['chado_type_column'];
+    $cv_id      = $this->details['chado_cv_id'];
+    $cvterm_id  = $this->details['chado_cvterm_id'];
+
+    $this->field_name = 'organism__type_id';
+  }
   /**
    * @see TripalField::create_info()
    */
@@ -54,7 +66,7 @@ class chado_organism__type_id extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'organism__type_id',
+      'field_name' => $this->field_name,
       'type' => 'chado_organism__type_id',
       'cardinality' => 1,
       'locked' => FALSE,
@@ -83,7 +95,7 @@ class chado_organism__type_id extends TripalField {
     $cvterm_id  = $this->details['chado_cvterm_id'];
 
     return array(
-      'field_name' => 'organism__type_id',
+      'field_name' => $this->field_name,
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle->name,
       'label' => 'Infrapsecific Type',
@@ -176,7 +188,7 @@ class chado_organism__type_id extends TripalField {
   /**
    * @see TripalField::load()
    */
-  public function load($field, $entity, $details) {
+  static function load($field, $entity, $details = array()) {
 
     $record = $details['record'];
     $settings = $field['settings'];

+ 3 - 13
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -287,13 +287,7 @@ function tripal_chado_field_storage_load($entity_type, $entities, $age,
         // that need populationg besides the value which was set above.
         module_load_include('inc', $field_module, 'includes/fields/' . $field_type);
         if (preg_match('/^chado/', $field_type) and class_exists($field_type)) {
-          $field_obj = new $field_type();
-          $field_obj->load($field, $entity, array('record' => $record));
-        }
-
-        $load_function = $field_type . '_load';
-        if (function_exists($load_function)) {
-          $load_function($field, $entity, $base_table, $record);
+          $field_type::load($field, $entity, array('record' => $record));
         }
       }
 
@@ -306,12 +300,8 @@ function tripal_chado_field_storage_load($entity_type, $entities, $age,
         $entity->{$field_name}['und'][0]['value'] = '';
         $load_function = $field_type . '_load';
         module_load_include('inc', $field_module, 'includes/fields/' . $field_type);
-
-        if (preg_match('/^chado/', $field_type) and class_exists($field_type)) {
-          $field_obj = new $field_type();
-          if (method_exists($field_obj, 'load')) {
-            $field_obj->load($field, $entity, array('record' => $record));
-          }
+        if (class_exists($field_type)) {
+          $field_type::load($field, $entity, array('record' => $record));
         }
       }
 

+ 2 - 0
tripal_chado/includes/tripal_chado.fields.inc

@@ -43,7 +43,9 @@ function tripal_chado_field_create_info($entity_type, $bundle) {
   );
 
   $base_fields = tripal_chado_field_create_base('create_info', $entity_type, $bundle, $details);
+  dpm($base_fields);
   $custom_fields = tripal_chado_field_create_info_custom($entity_type, $bundle, $details);
+  dpm($custom_fields);
   return array_merge($base_fields, $custom_fields);
 }