11 my $schema = DBICTest->init_schema();
16 # warn Dumper [$schema->resultset('Artist')->search ({}, { prefetch => 'cds' })->hri_dump->all];
19 # while cds.* will be selected anyway (prefetch currently forces the result of _resolve_prefetch)
20 # only the requested me.name column will be fetched. This somehow does work on 08010 (tested)
22 # reference sql with select => [...]
23 # SELECT me.name, cds.title, cds.cdid, cds.artist, cds.title, cds.year, cds.genreid, cds.single_track FROM ...
25 my $rs = $schema->resultset('Artist')->search(
26 { 'cds.title' => { '!=', 'Generic Manufactured Singles' } },
28 prefetch => [ qw/ cds / ],
29 order_by => [ { -desc => 'me.name' }, 'cds.title' ],
30 select => [ qw/ me.name cds.title / ],
34 is ($rs->count, 2, 'Correct number of collapsed artists');
35 my $we_are_goth = $rs->first;
36 is ($we_are_goth->name, 'We Are Goth', 'Correct first artist');
37 is ($we_are_goth->cds->count, 1, 'Correct number of CDs for first artist');
38 is ($we_are_goth->cds->first->title, 'Come Be Depressed With Us', 'Correct cd for artist');