This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/lib/Pear/LocalLoop/Schema/ResultSet/Category.pm

27 lines
488 B
Perl
Raw Normal View History

2018-03-26 13:42:18 +00:00
package Pear::LocalLoop::Schema::ResultSet::Category;
use strict;
use warnings;
use base 'DBIx::Class::ResultSet';
sub as_hash {
2021-03-20 12:09:50 +00:00
my ($self) = @_;
2018-03-26 13:42:18 +00:00
2021-03-20 23:26:52 +00:00
my %category_list =
( ( map { $_->id => $_->name, } $self->all ), 0 => 'Uncategorised', );
2021-03-20 12:09:50 +00:00
return \%category_list;
2018-03-26 13:42:18 +00:00
}
sub as_hash_name_icon {
2021-03-20 12:09:50 +00:00
my ($self) = @_;
2021-03-20 12:09:50 +00:00
my %category_list = (
2021-03-20 23:26:52 +00:00
( map { $_->name => $_->line_icon, } $self->all ),
2021-03-20 12:09:50 +00:00
0 => 'Uncategorised',
);
return \%category_list;
}
2018-03-26 13:42:18 +00:00
1;