$schema->resultset("Artist")->populate([
{ artistid => 4, name => 'Manufactured Crap', cds => [
{ title => 'My First CD', year => 2006 },
{ title => 'Yet More Tweeny-Pop crap', year => 2007 },
],
},
{ artistid => 5, name => 'Angsty-Whiny Girl', cds => [
{ title => 'My parents sold me to a record company', year => 2005 },
{ title => 'Why Am I So Ugly?', year => 2006 },
{ title => 'I Got Surgery and am now Popular', year => 2007 }
],
},
]);
####
my $artistsAndTitles = $schema->resultset('Artist')->
search(...)->search_related_rs('cds', {...})->as_data
# or another case using a accessor-method with the name 'cds' from a many_to_many relation:
my $artistsAndTitles = $schema->resultset('Artist')->
cds()->as_data ;
####
[
{ artistid => 4, name => 'Manufactured Crap', cds => [
{ title => 'My First CD', year => 2006 },
{ title => 'Yet More Tweeny-Pop crap', year => 2007 },
],
},
{ artistid => 5, name => 'Angsty-Whiny Girl', cds => [
{ title => 'My parents sold me to a record company', year => 2005 },
{ title => 'Why Am I So Ugly?', year => 2006 },
{ title => 'I Got Surgery and am now Popular', year => 2007 }
],
}
]