aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-01-24 11:08:11 +0000
committerStruan Donald <struan@exo.org.uk>2013-01-24 11:08:11 +0000
commit0b416d2c3d7232ee083b3057420f3f1e52cdb46b (patch)
tree1ed6f44a5bacd0f984a50ed27ba11d887538444d /perllib/FixMyStreet/DB/Result/Problem.pm
parentdc60d611ec350fa024959117ea90daa3cfd37245 (diff)
add basic ability to return a report as json
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 20b79167f..c7fb37a84 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -731,6 +731,23 @@ sub update_send_failed {
} );
}
+sub as_hashref {
+ my $self = shift;
+ my $c = shift;
+
+ return {
+ id => $self->id,
+ title => $self->title,
+ category => $self->category,
+ detail => $self->detail,
+ latitude => $self->latitude,
+ longitude => $self->longitude,
+ postcode => $self->postcode,
+ photo => $self->get_photo_params,
+ meta => $self->meta_line( $c ),
+ };
+}
+
# we need the inline_constructor bit as we don't inherit from Moose
__PACKAGE__->meta->make_immutable( inline_constructor => 0 );