Skip to content

Instantly share code, notes, and snippets.

@plu
Created November 23, 2010 16:45
Show Gist options
  • Save plu/712077 to your computer and use it in GitHub Desktop.
Save plu/712077 to your computer and use it in GitHub Desktop.
package DAO::Example::DB::ResultSet::Person;
use strict;
use warnings;
use base qw/DAO::Example::DB::Base::ResultSet/;
sub by_username {
my ( $rs, $username ) = @_;
return $rs->search( { 'me.username' => $username }, { key => 'unique_username' } );
}
sub prefetch_all {
my ($rs) = @_;
return $rs->search( {}, { prefetch => [ { personroles => [qw/role/] } ] } );
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment