Skip to content

Commit

Permalink
Merge pull request #1184 from dsenalik/1183-tv3-schema__publications
Browse files Browse the repository at this point in the history
Bugfix for Issue #1183 schema__publications field
  • Loading branch information
spficklin committed Mar 29, 2021
2 parents dae8b84 + f0a6943 commit 52599c8
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,33 +135,36 @@ class schema__publication extends ChadoField {
$i = 0;
foreach ($record->$linker_table as $index => $linker) {
$pub = $linker->pub_id;
$pubs[$pub->pub_id] = $pub;
$pubs[$pub->pub_id] = [
'pub' => $pub,
'pkey' => $linker->$pkey,
];
}
}
}
else {
$pub = $record->{$field_column};
if ($pub) {
$pubs[$pub->pub_id] = $pub;
$pubs[$pub->pub_id]['pub'] = $pub;
}
}

$i = 0;
foreach ($pubs as $pub_id => $pub) {
$pub_details = chado_get_minimal_pub_info($pub);
$pub_details = chado_get_minimal_pub_info($pub['pub']);

$entity->{$field_name}['und'][$i]['value'] = $pub_details;
if ($linker_table) {
$entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . $pkey] = $linker->$pkey;
$entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . $pkey] = $pub['pkey'];
$entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . $fkey_lcolumn] = $linker->$fkey_lcolumn->$fkey_lcolumn;
$entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . 'pub_id'] = $pub_id;
}
else {
$entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . $field_column] = $pub_id;
}

if (property_exists($pub, 'entity_id')) {
$entity->{$field_name}['und'][$i]['value']['entity'] = 'TripalEntity:' . $pub->entity_id;
if (property_exists($pub['pub'], 'entity_id')) {
$entity->{$field_name}['und'][$i]['value']['entity'] = 'TripalEntity:' . $pub['pub']->entity_id;
}
$i++;
}
Expand Down

0 comments on commit 52599c8

Please sign in to comment.