From 88339b57b2f4ce04b0b1e74a01419ccdbacc6e0c Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Wed, 21 Jun 2017 13:30:31 +0100 Subject: Add Body::first_area_children method --- perllib/FixMyStreet/DB/Result/Body.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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. -- cgit v1.2.3