8 # More tests like this in t/prefetch/manual.t
10 my $schema = DBICTest->init_schema(no_populate => 1, quote_names => 1);
11 $schema->resultset('Artist')->create({ name => 'JMJ', cds => [{
12 title => 'Magnetic Fields',
14 genre => { name => 'electro' },
24 $schema->resultset('CD')->create({
27 artist => { name => 'JMJ' },
28 genre => { name => 'electro' },
39 artist => { name => 'JMJ' },
41 { title => 'o2', position => 2}, # the position should not be needed here, bug in MC
48 $schema->resultset('CD')->create({ artist => 1, year => 1977, title => "fuzzy_$_" });
51 my $rs = $schema->resultset('CD');
57 'single_track.cd.artist.name' => 'artist.name',
59 join => { single_track => { cd => 'artist' } },
60 order_by => [qw/me.cdid artist.artistid/],
64 single_track => undef,
68 single_track => undef,
82 single_track => undef,
86 single_track => undef,
90 'plain 1:1 descending chain'
96 'artist' => 'me.artist',
97 'title' => 'me.title',
99 'single_track.cd.artist.artistid' => 'artist.artistid',
100 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
101 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
103 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
104 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
109 single_track => undef,
110 title => "Magnetic Fields",
115 single_track => undef,
315 single_track => undef,
321 single_track => undef,
326 'non-collapsing 1:1:1:M:M chain',
332 'artist' => 'me.artist',
333 'title' => 'me.title',
335 'single_track.cd.artist.artistid' => 'artist.artistid',
336 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
337 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
339 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
340 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
341 collapse => {}, #hashref to keep older DBIC versions happy (doesn't actually work)
346 single_track => undef,
347 title => "Magnetic Fields",
352 single_track => undef,
422 single_track => undef,
428 single_track => undef,
433 'collapsing 1:1:1:M:M chain',