I understand in dbic that many-to-many isn't a real relationship and what I've done up until now is used the add_to_$rel function.
Is it possible to structure my many-to-many data in such a way that I can insert it using multicreate?
Many thanks
I understand in dbic that many-to-many isn't a real relationship and what I've done up until now is used the add_to_$rel function.
Is it possible to structure my many-to-many data in such a way that I can insert it using multicreate?
Many thanks
many-to-many are not relationships but relationship helpers, see https://metacpan.org/pod/DBIx::Class::Relationship#many_to_many.
You need to use the two underlying relationships for the data structure you're passing to create:
$rs->create({
rel_to_bridge_table => {
column_in_bridge_table => 'foo',
rel_to_remote_table => {
col1 => 'bar',
col2 => 'baz',
}
}
});