|
@@ -381,11 +381,12 @@ function tripal_get_chado_entity_id ($chado_table, $record_id) {
|
|
|
// type_column, and type_id.
|
|
|
$bundle_id = NULL;
|
|
|
if ($type_column) {
|
|
|
- $pkey = $chado_table . "_id";
|
|
|
+ $schema = chado_get_schema($chado_table);
|
|
|
+ $pkey = is_array($schema['primary key']) ? $schema['primary key'][0] : $schema['primary key'];
|
|
|
$type_id = NULL;
|
|
|
if (key_exists($type_column, $schema['fields'])) {
|
|
|
$type_id =
|
|
|
- chado_db_select($chado_table, 'C')
|
|
|
+ db_select("chado.$chado_table", 'C')
|
|
|
->fields('C', array($type_column))
|
|
|
->condition($pkey, $record_id)
|
|
|
->execute()
|