| 1 | package Reaction::InterfaceModel::Collection::DBIC::Role::Where; | ||||||||||
| 2 | |||||||||||
| 3 | 5 | ▶ | use Reaction::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 5 | ▶ | use Scalar::Util qw/blessed/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 5 | ▶ | use namespace::clean -except => [ qw(meta) ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | |||||||||||
| 9 | #requires qw/_source_resultset _im_class/; | ||||||||||
| 10 | 0 | ▶ | sub where { | ||||||||
|
Subroutine
where: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 11 | 0 | my $self = shift; | |||||||||
| 12 | 0 | my $rs = $self->_source_resultset->search_rs(@_); | |||||||||
| 13 | 0 | return (blessed $self)->new( | |||||||||
| 14 | _source_resultset => $rs, | ||||||||||
| 15 | member_type => $self->member_type | ||||||||||
| 16 | ); | ||||||||||
| 17 | }; | ||||||||||
| 18 | 0 | ▶ | sub add_where { | ||||||||
|
Subroutine
add_where: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 19 | 0 | my $self = shift; | |||||||||
| 20 | 0 | my $rs = $self->_source_resultset->search_rs(@_); | |||||||||
| 21 | 0 | $self->_source_resultset($rs); | |||||||||
| 22 | 0 | ▶ | $self->_clear_collection_store if $self->_has_collection_store; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | return $self; | |||||||||
| 24 | }; | ||||||||||
| 25 | |||||||||||
| 26 | #XXX may need a rename, but i needed this for ListView | ||||||||||
| 27 | 3 | ▶ | sub find { | ||||||||
|
Subroutine
find: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 28 | 3 | my $self = shift; | |||||||||
| 29 | 3 | $self->_source_resultset | |||||||||
| 30 | ->search({},{result_class => $self->member_type}) | ||||||||||
| 31 | ->find(@_); | ||||||||||
| 32 | }; | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 5 | 1; | |||||||||
| 36 | |||||||||||
| 37 | =head1 NAME | ||||||||||
| 38 | |||||||||||
| 39 | Reaction::InterfaceModel::Collection::DBIC::Role::Where | ||||||||||
| 40 | |||||||||||
| 41 | =head1 DESCRIPTION | ||||||||||
| 42 | |||||||||||
| 43 | Provides methods to allow a ResultSet collection to be restricted | ||||||||||
| 44 | |||||||||||
| 45 | =head1 METHODS | ||||||||||
| 46 | |||||||||||
| 47 | =head2 where | ||||||||||
| 48 | |||||||||||
| 49 | Will return a clone with a restricted C<_source_resultset>. | ||||||||||
| 50 | |||||||||||
| 51 | =head2 add_where | ||||||||||
| 52 | |||||||||||
| 53 | Will return itself after restricting C<_source_resultset>. This also clears the | ||||||||||
| 54 | C<_collection_store> | ||||||||||
| 55 | |||||||||||
| 56 | =head1 AUTHORS | ||||||||||
| 57 | |||||||||||
| 58 | See L<Reaction::Class> for authors. | ||||||||||
| 59 | |||||||||||
| 60 | =head1 LICENSE | ||||||||||
| 61 | |||||||||||
| 62 | See L<Reaction::Class> for the license. | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||