Remove Class::Data::Inheritable and use CAG 'inherited' style accessors
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / AbstractSearch.pm
1 package # hide form PAUSE
2     DBIx::Class::CDBICompat::AbstractSearch;
3
4 use strict;
5 use warnings;
6
7 use base 'DBIx::Class';
8
9 =head1 NAME
10
11 DBIx::Class::CDBICompat::AbstractSearch - Emulates Class::DBI::AbstractSearch
12
13 =head1 SYNOPSIS
14
15 See DBIx::Class::CDBICompat for usage directions.
16
17 =head1 DESCRIPTION
18
19 Emulates L<Class::DBI::AbstractSearch>.
20
21 =cut
22
23 # The keys are mostly the same.
24 my %cdbi2dbix = (
25     limit               => 'rows',
26 );
27
28 sub search_where {
29     my $class = shift;
30     my $where = (ref $_[0]) ? $_[0] : { @_ };
31     my $attr  = (ref $_[0]) ? $_[1] : {};
32
33     # Translate the keys
34     $attr->{$cdbi2dbix{$_}} = delete $attr->{$_} for keys %cdbi2dbix;
35
36     return $class->resultset_instance->search($where, $attr);
37 }
38
39 =head1 FURTHER QUESTIONS?
40
41 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
42
43 =head1 COPYRIGHT AND LICENSE
44
45 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
46 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
47 redistribute it and/or modify it under the same terms as the
48 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
49
50 =cut
51
52 1;