[Dbix-class] create with has_many

Dermot paikkos at googlemail.com
Tue Mar 3 13:24:47 GMT 2009


Hi

(sorry for the abortive email earlier, dammed tab key )

When creating a new row and also creating rows in a related has_many
or has_one resultset, how do you set the FK in the related table.
In this example, artist_id.


my $artist = {
  name => 'the smiths',
  cds => [
       {title => "hatful of hollow", artist_id => },
       {title => 'meat is murder', artist_id => },
     ]};


Similarly, should I be using 'last_insert_id +1 ' on the artist table
to set it's PK or does DBIx::Class::Core take care of that?
TIA,
Dp.



More information about the DBIx-Class mailing list