Skip to content

Instantly share code, notes, and snippets.

@rbuels
Forked from nmenda/add_new_cvterm
Created January 25, 2010 18:49
Show Gist options
  • Save rbuels/286115 to your computer and use it in GitHub Desktop.
Save rbuels/286115 to your computer and use it in GitHub Desktop.
my $pub_cv =
$schema->resultset('Cv::Cv')
->find_or_create({ name => 'publication' });
my $journal_cvterm = $pub_cv->find_related('cvterms',
{ name => 'journal' }
);
$journal_cvterm ||= $schema->resultset('General::Db')
->find_or_create( { name => 'null' } )
->find_or_create_related('dbxrefs',
{ name => 'null' },
)
->create_related('cvterms',
{ name => 'journal',
cv_id => $pub_cv->cv_id,
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment