added getAll()

This commit is contained in:
JT Smith 2008-09-19 21:54:47 +00:00
parent 195bdb6a5e
commit 5605c056c7

View file

@ -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;