Skip to content

Commit

Permalink
Merge pull request #1433 from tripal/tv5g1-issue1432-check-for-missin…
Browse files Browse the repository at this point in the history
…g-base-table

BUG: organism field cannot be added manually to gene page
  • Loading branch information
dsenalik committed Mar 29, 2023
2 parents 687343a + d9a2791 commit b2ed602
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tripal_chado/src/Plugin/Field/FieldType/obi__organism.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ public static function tripalTypes($field_definition) {
// Get the base table columns needed for this field.
$settings = $field_definition->getSetting('storage_plugin_settings');
$base_table = $settings['base_table'];

// If we don't have a base table then we're not ready to specify the
// properties for this field.
if (!$base_table) {
$record_id_term = 'OBI:0100026';
return [
new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'record_id', $record_id_term, [
'action' => 'store_id',
'drupal_store' => TRUE,
])
];
}

$base_schema_def = $schema->getTableDef($base_table, ['format' => 'Drupal']);
$base_pkey_col = $base_schema_def['primary key'];
$base_fk_col = array_keys($base_schema_def['foreign keys']['organism']['columns'])[0];
Expand Down

0 comments on commit b2ed602

Please sign in to comment.