kivitendo/SL/DB/Helpers/Manager.pm @ cbbcefbb
82515b2d | Sven Schöling | package SL::DB::Helpers::Manager;
|
|
use strict;
|
|||
use Rose::DB::Object::Manager;
|
|||
use base qw(Rose::DB::Object::Manager);
|
|||
sub make_manager_methods {
|
|||
my $class = shift;
|
|||
my @params = scalar(@_) ? @_ : qw(all);
|
|||
return $class->SUPER::make_manager_methods(@params);
|
|||
}
|
|||
sub find_by {
|
|||
my $class = shift;
|
|||
return if !@_;
|
|||
return $class->get_all(query => [ @_ ], limit => 1)->[0];
|
|||
}
|
|||
sub get_first {
|
|||
shift->get_all(
|
|||
limit => 1,
|
|||
)->[0];
|
|||
}
|
|||
1;
|