pairs of column name/info at once
- $rs->search now throws when called in void context, as it makes
no sense (and is nearly always a sign of a bug/misdesign)
+ - Deprecate legacy $rs->search( %condition ) syntax
- NULL is now supplied unquoted to all debug-objects, in order to
differentiate between a real NULL and the string 'NULL'
}
my $call_attrs = {};
- $call_attrs = pop(@_) if @_ > 1 and ref $_[-1] eq 'HASH';
+ $call_attrs = pop(@_) if (
+ @_ > 1 and ( ! defined $_[-1] or ref $_[-1] eq 'HASH' )
+ );
# see if we can keep the cache (no $rs changes)
my $cache;
} if @_;
+ carp 'search( %condition ) is deprecated, use search( \%condition ) instead'
+ if (@_ > 1 and ! $self->result_source->result_class->isa('DBIx::Class::CDBICompat') );
+
for ($old_where, $call_cond) {
if (defined $_) {
$new_attrs->{where} = $self->_stack_cond (
$artist->delete;
}
+# deprecation of rolled-out search
+warnings_exist {
+ $schema->resultset('Artist')->search_rs(id => 4)
+} qr/\Qsearch( %condition ) is deprecated/, 'Deprecation warning on ->search( %condition )';
+
# this has been warning for 4 years, killing
throws_ok {
$schema->resultset('Artist')->find(artistid => 4);
} );
}
$schema->storage->txn_rollback;
-($artist) = $schema->resultset("Artist")->search( artistid => 25 );
+($artist) = $schema->resultset("Artist")->search({ artistid => 25 });
is($artist, undef, "Rollback ok");
is_deeply (
} );
$track->update_from_related( cd => $cd );
-my $t_cd = ($schema->resultset("Track")->search( cd => 4, title => 'Hidden Track 2' ))[0]->cd;
+my $t_cd = ($schema->resultset("Track")->search({ cd => 4, title => 'Hidden Track 2' }))[0]->cd;
is( $t_cd->cdid, 4, 'update_from_related ok' );
is( ($artist->search_related('cds'))[4]->title, 'Greatest Hits', 'find_or_create_related new record search ok' );
$artist->delete_related( cds => { title => 'Greatest Hits' });
-cmp_ok( $schema->resultset("CD")->search( title => 'Greatest Hits' ), '==', 0, 'delete_related ok' );
+cmp_ok( $schema->resultset("CD")->search({ title => 'Greatest Hits' }), '==', 0, 'delete_related ok' );
# find_or_new_related with an existing record
$cd = $artist->find_or_new_related( 'cds', { title => 'Big Flop' } );
is( $producers[0]->name, 'Matt S Trout', 'many_to_many ok' );
is( $cd->producers_sorted->next->name, 'Bob The Builder',
'sorted many_to_many ok' );
-is( $cd->producers_sorted(producerid => 3)->next->name, 'Fred The Phenotype',
+is( $cd->producers_sorted({producerid => 3})->next->name, 'Fred The Phenotype',
'sorted many_to_many with search condition ok' );
$cd = $schema->resultset('CD')->find(2);
ok $link->id;
$link->delete;
-is $schema->resultset("Link")->search(id => $link_id)->count, 0,
+is $schema->resultset("Link")->search({id => $link_id})->count, 0,
"link $link_id was deleted";
# Get a fresh object with nothing cached
# This would create a new link row if none existed
$bookmark->link;
-is $schema->resultset("Link")->search(id => $link_id)->count, 0,
+is $schema->resultset("Link")->search({id => $link_id})->count, 0,
'accessor did not create a link object where there was none';