9 # More tests like this in t/prefetch/manual.t
11 my $schema = DBICTest->init_schema(no_populate => 1, quote_names => 1);
12 $schema->resultset('Artist')->create({ name => 'JMJ', cds => [{
13 title => 'Magnetic Fields',
15 genre => { name => 'electro' },
25 $schema->resultset('CD')->create({
28 artist => { name => 'JMJ' },
29 genre => { name => 'electro' },
40 artist => { name => 'JMJ' },
42 { title => 'o2', position => 2}, # the position should not be needed here, bug in MC
49 $schema->resultset('CD')->create({ artist => 1, year => 1977, title => "fuzzy_$_" });
53 package DBICTest::HRI::Subclass;
54 use base 'DBIx::Class::ResultClass::HashRefInflator';
58 package DBICTest::HRI::Around;
59 use base 'DBIx::Class::ResultClass::HashRefInflator';
61 sub inflate_result { shift->next::method(@_) }
65 $schema->resultset('CD')->search_rs({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' }),
66 $schema->resultset('CD')->search_rs({}, { result_class => 'DBICTest::HRI::Subclass' }),
67 $schema->resultset('CD')->search_rs({}, { result_class => 'DBICTest::HRI::Around' }),
74 'single_track.cd.artist.name' => 'artist.name',
76 join => { single_track => { cd => 'artist' } },
77 order_by => [qw/me.cdid artist.artistid/],
81 single_track => undef,
85 single_track => undef,
99 single_track => undef,
103 single_track => undef,
107 'plain 1:1 descending chain ' . $rs->result_class
113 'artist' => 'me.artist',
114 'title' => 'me.title',
116 'single_track.cd.artist.artistid' => 'artist.artistid',
117 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
118 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
120 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
121 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
126 single_track => undef,
127 title => "Magnetic Fields",
132 single_track => undef,
332 single_track => undef,
338 single_track => undef,
343 'non-collapsing 1:1:1:M:M chain ' . $rs->result_class,
349 'artist' => 'me.artist',
350 'title' => 'me.title',
352 'single_track.cd.artist.artistid' => 'artist.artistid',
353 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
354 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
356 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
357 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
363 single_track => undef,
364 title => "Magnetic Fields",
369 single_track => undef,
439 single_track => undef,
445 single_track => undef,
450 'collapsing 1:1:1:M:M chain ' . $rs->result_class,