$cd = $schema->resultset("CD")->search({ title => 'Spoonful of bees' }, { columns => ['title'] })->next;
is($cd->title, 'Spoonful of bees', 'subset of columns returned correctly');
-$cd = $schema->resultset("CD")->search(undef, { include_columns => [ { name => 'artist.name' } ], join => [ 'artist' ] })->find(1);
+$cd = $schema->resultset("CD")->search(undef, { '+columns' => [ { name => 'artist.name' } ], join => [ 'artist' ] })->find(1);
is($cd->title, 'Spoonful of bees', 'Correct CD returned with include');
is($cd->get_column('name'), 'Caterwauler McCrae', 'Additional column returned');
$rel_rs->reset;
my $tag = $schema->resultset('Tag')->search(
- [ { 'me.tag' => 'Blue' } ], { cols=>[qw/tagid/] } )->next;
+ [ { 'me.tag' => 'Blue' } ],
+ { columns => 'tagid' }
+)->next;
ok($tag->has_column_loaded('tagid'), 'Has tagid loaded');
ok(!$tag->has_column_loaded('tag'), 'Has not tag loaded');
my $cd_rs = $schema->resultset("CD");
warnings_exist( sub {
- $cd_rs->search_rs( undef, { cols => [ { name => 'artist.name' } ], join => [ 'artist' ] })
+ my $cd = $cd_rs->search( undef, {
+ cols => [ { name => 'artist.name' } ],
+ join => 'artist',
+ })->next;
+
+ is_deeply (
+ { $cd->get_inflated_columns },
+ { name => 'Caterwauler McCrae' },
+ 'cols attribute still works',
+ );
}, qr/Resultset attribute 'cols' is deprecated/,
'deprecation warning when passing cols attribute');
warnings_exist( sub {
- $cd_rs->search_rs( undef, {
- include_columns => [ { name => 'artist.name' } ], join => [ 'artist' ]
- })
+ my $cd = $cd_rs->search_rs( undef, {
+ include_columns => [ { name => 'artist.name' } ],
+ join => 'artist',
+ })->next;
+
+ is (
+ $cd->get_column('name'),
+ 'Caterwauler McCrae',
+ 'include_columns attribute still works',
+ );
}, qr/Resultset attribute 'include_columns' is deprecated/,
'deprecation warning when passing include_columns attribute');