added getAll()
This commit is contained in:
parent
195bdb6a5e
commit
5605c056c7
1 changed files with 16 additions and 0 deletions
|
|
@ -187,6 +187,22 @@ sub get {
|
|||
return \%copy;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getAll {
|
||||
my ($class, $session, $options) = @_;
|
||||
my @objects;
|
||||
my $ids = $session->db->read("select `".$class->crud_getTableKey."` from `".$class->crud_getTableName."`");
|
||||
while (my ($id) = $ids->array) {
|
||||
if ($options->{return} eq "ids") {
|
||||
push @objects, $id;
|
||||
}
|
||||
else {
|
||||
push @objects, $class->new($session, $id);
|
||||
}
|
||||
}
|
||||
return \@objects;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getId {
|
||||
my $self = shift;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue