aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2017-06-21 13:30:31 +0100
committerDave Arter <davea@mysociety.org>2017-07-17 14:17:45 +0100
commit88339b57b2f4ce04b0b1e74a01419ccdbacc6e0c (patch)
tree535e3959c1aedc00ace64524ff22a9eabd6f7e9f /perllib
parent105b2fbd64f4e2482c578ad499ec220f5ee49384 (diff)
Add Body::first_area_children method
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/DB/Result/Body.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm
index 82015ad2d..9a64d1608 100644
--- a/perllib/FixMyStreet/DB/Result/Body.pm
+++ b/perllib/FixMyStreet/DB/Result/Body.pm
@@ -133,6 +133,18 @@ sub areas {
return \%ids;
}
+sub first_area_children {
+ my ( $self, $c ) = @_;
+
+ my $area_id = $self->body_areas->first->area_id;
+
+ my $children = mySociety::MaPit::call('area/children', $area_id,
+ type => $c->cobrand->area_types_children,
+ );
+
+ return $children;
+}
+
=head2 get_cobrand_handler
Get a cobrand object for this body, if there is one.