9 my $schema = DBICTest->init_schema();
11 my $mo_rs = $schema->resultset('Artist')->search(
12 { 'me.artistid' => 4 },
17 { tracks => { cd_single => 'tracks' } },
18 { cd_to_producer => 'producer' }
21 { artwork_to_artist => 'artwork' }
24 result_class => 'DBIx::Class::ResultClass::HashRefInflator',
29 $schema->resultset('Artist')->create(
35 title => 'Song of a Foo',
39 title => 'Foo Me Baby One More Time',
42 title => 'Foo Me Baby One More Time II',
45 title => 'Foo Me Baby One More Time III',
48 title => 'Foo Me Baby One More Time IV',
50 { artist => 1, title => 'MO! Single', year => 2021, tracks => [
51 { title => 'singled out' }, { title => 'still alone' },
56 { producer => { name => 'riba' } },
57 { producer => { name => 'sushi' } },
61 title => 'Song of a Foo II',
65 title => 'Quit Playing Games With My Heart',
73 { artist => 2, title => 'MO! Single', year => 2020, tracks => [
74 { title => 'singled out' }, { title => 'still alone' },
79 { producer => { name => 'riba' } },
80 { producer => { name => 'sushi' } },
85 [ { artwork => { cd_id => 1 } }, { artwork => { cd_id => 2 } } ]
89 my $mo = $mo_rs->next;
91 is( @{$mo->{cds}}, 2, 'two CDs' );
98 'single_track' => undef,
105 'title' => 'Foo Me Baby One More Time',
106 'cd_single' => undef,
107 'last_updated_on' => undef,
108 'last_updated_at' => undef
115 'title' => 'Foo Me Baby One More Time II',
116 'cd_single' => undef,
117 'last_updated_on' => undef,
118 'last_updated_at' => undef
125 'title' => 'Foo Me Baby One More Time III',
126 'cd_single' => undef,
127 'last_updated_on' => undef,
128 'last_updated_at' => undef
135 'title' => 'Foo Me Baby One More Time IV',
136 'last_updated_on' => undef,
137 'last_updated_at' => undef,
139 'single_track' => '22',
142 'title' => 'MO! Single',
150 'title' => 'singled out',
152 'last_updated_at' => undef,
153 'last_updated_on' => undef
159 'title' => 'still alone',
161 'last_updated_at' => undef,
162 'last_updated_on' => undef
170 'cd_to_producer' => [
172 'attribute' => undef,
180 'attribute' => undef,
188 'title' => 'Song of a Foo',
193 'single_track' => undef,
196 # although the positional ordering is correct, SQLite seems to return
197 # the rows randomly if an ORDER BY is not supplied. Of course ordering
198 # by right side of prefetch joins is not yet possible, thus we just hope
199 # that the order is stable
205 'title' => 'Bar Foo',
206 'cd_single' => undef,
207 'last_updated_on' => undef,
208 'last_updated_at' => undef
215 'title' => 'Quit Playing Games With My Heart',
216 'last_updated_on' => undef,
217 'last_updated_at' => undef,
218 'cd_single' => undef,
225 'title' => 'Foo Bar',
226 'last_updated_on' => undef,
227 'last_updated_at' => undef,
229 'single_track' => '27',
232 'title' => 'MO! Single',
240 'title' => 'singled out',
242 'last_updated_at' => undef,
243 'last_updated_on' => undef
249 'title' => 'still alone',
251 'last_updated_at' => undef,
252 'last_updated_on' => undef
261 'cd_to_producer' => [
263 'attribute' => undef,
271 'attribute' => undef,
279 'title' => 'Song of a Foo II',
285 'charfield' => undef,
287 'artwork_to_artist' => [
289 'artwork' => { 'cd_id' => '1' },
291 'artwork_cd_id' => '1'
294 'artwork' => { 'cd_id' => '2' },
296 'artwork_cd_id' => '2'