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/],
80 { year => 1981, single_track => undef },
81 { year => 1976, single_track => undef },
82 { year => 1978, single_track => {
84 artist => { name => "JMJ" }
87 { year => 1977, single_track => undef },
88 { year => 1977, single_track => undef },
91 'plain 1:1 descending chain ' . $rs->result_class
97 'artist' => 'me.artist',
98 'title' => 'me.title',
100 'single_track.cd.artist.artistid' => 'artist.artistid',
101 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
102 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
104 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
105 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
109 artist => 1, title => "Magnetic Fields", year => 1981, single_track => undef,
112 artist => 1, title => "Oxygene", year => 1976, single_track => undef,
115 artist => 1, title => "Equinoxe", year => 1978, single_track => {
118 artistid => 1, cds => {
119 cdid => 1, tracks => {
128 artist => 1, title => "Equinoxe", year => 1978, single_track => {
131 artistid => 1, cds => {
132 cdid => 1, tracks => {
141 artist => 1, title => "Equinoxe", year => 1978, single_track => {
144 artistid => 1, cds => {
145 cdid => 1, tracks => {
154 artist => 1, title => "Equinoxe", year => 1978, single_track => {
157 artistid => 1, cds => {
158 cdid => 1, tracks => {
167 artist => 1, title => "Equinoxe", year => 1978, single_track => {
170 artistid => 1, cds => {
171 cdid => 2, tracks => {
180 artist => 1, title => "Equinoxe", year => 1978, single_track => {
183 artistid => 1, cds => {
184 cdid => 2, tracks => {
193 artist => 1, title => "Equinoxe", year => 1978, single_track => {
196 artistid => 1, cds => {
197 cdid => 3, tracks => {
206 artist => 1, title => "Equinoxe", year => 1978, single_track => {
209 artistid => 1, cds => {
210 cdid => 3, tracks => {
219 artist => 1, title => "Equinoxe", year => 1978, single_track => {
222 artistid => 1, cds => {
223 cdid => 3, tracks => {
232 artist => 1, title => "Equinoxe", year => 1978, single_track => {
235 artistid => 1, cds => {
236 cdid => 4, tracks => undef
243 artist => 1, title => "Equinoxe", year => 1978, single_track => {
246 artistid => 1, cds => {
247 cdid => 5, tracks => undef
254 artist => 1, title => "fuzzy_1", year => 1977, single_track => undef,
257 artist => 1, title => "fuzzy_2", year => 1977, single_track => undef,
260 'non-collapsing 1:1:1:M:M chain ' . $rs->result_class,
266 'artist' => 'me.artist',
267 'title' => 'me.title',
269 'single_track.cd.artist.artistid' => 'artist.artistid',
270 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
271 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
273 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
274 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
279 artist => 1, title => "Magnetic Fields", year => 1981, single_track => undef,
282 artist => 1, title => "Oxygene", year => 1976, single_track => undef,
285 artist => 1, title => "Equinoxe", year => 1978, single_track => {
288 artistid => 1, cds => [
290 cdid => 1, tracks => [
298 cdid => 2, tracks => [
304 cdid => 3, tracks => [
311 cdid => 4, tracks => [],
314 cdid => 5, tracks => [],
322 artist => 1, title => "fuzzy_1", year => 1977, single_track => undef,
325 artist => 1, title => "fuzzy_2", year => 1977, single_track => undef,
328 'collapsing 1:1:1:M:M chain ' . $rs->result_class,