| Reaction documentation | Contained in the Reaction distribution. |
Reaction::InterfaceModel::Collection::DBIC::Role::Where
Provides methods to allow a ResultSet collection to be restricted
Will return a clone with a restricted _source_resultset.
Will return itself after restricting _source_resultset. This also clears the
_collection_store
See Reaction::Class for authors.
See Reaction::Class for the license.
| Reaction documentation | Contained in the Reaction distribution. |
package Reaction::InterfaceModel::Collection::DBIC::Role::Where; use Reaction::Role; use Scalar::Util qw/blessed/; use namespace::clean -except => [ qw(meta) ]; #requires qw/_source_resultset _im_class/; sub where { my $self = shift; my $rs = $self->_source_resultset->search_rs(@_); return (blessed $self)->new( _source_resultset => $rs, member_type => $self->member_type ); }; sub add_where { my $self = shift; my $rs = $self->_source_resultset->search_rs(@_); $self->_source_resultset($rs); $self->_clear_collection_store if $self->_has_collection_store; return $self; }; #XXX may need a rename, but i needed this for ListView sub find { my $self = shift; $self->_source_resultset ->search({},{result_class => $self->member_type}) ->find(@_); }; 1;