diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-01-02 12:25:50 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-01-03 14:22:30 +0000 |
commit | c900b5057c6d3a9c389a0d0ac8524ab2e3abd8f8 (patch) | |
tree | 02b49c7f2705ae733b7a12006c60a235fb5ebf27 /perllib/FixMyStreet/DB/Result/Body.pm | |
parent | 39e549b3e1978cc5d6b29ba37f57ca90d3c391cb (diff) |
Add some new Body model helper methods.
And use the existing ones more.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Body.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Body.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm index e5cd2b907..07bea276c 100644 --- a/perllib/FixMyStreet/DB/Result/Body.pm +++ b/perllib/FixMyStreet/DB/Result/Body.pm @@ -158,10 +158,11 @@ sub areas { sub first_area_children { my ( $self ) = @_; - my $area_id = $self->body_areas->first->area_id; + my $body_area = $self->body_areas->first; + return unless $body_area; my $cobrand = $self->result_source->schema->cobrand; - my $children = mySociety::MaPit::call('area/children', $area_id, + my $children = mySociety::MaPit::call('area/children', $body_area->area_id, type => $cobrand->area_types_children, ); |