From a0af8d4624be9ca8579817d291036a6727aeb574 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 28 Jul 2017 19:15:52 +0200 Subject: further switching to db exceptions instead of return false --- includes/view/ShiftCalendarLane.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'includes/view/ShiftCalendarLane.php') diff --git a/includes/view/ShiftCalendarLane.php b/includes/view/ShiftCalendarLane.php index 774683bd..251b8013 100644 --- a/includes/view/ShiftCalendarLane.php +++ b/includes/view/ShiftCalendarLane.php @@ -38,15 +38,14 @@ class ShiftCalendarLane * Returns true on success. * * @param array $shift The shift to add - * @return boolean true on success */ public function addShift($shift) { if ($this->shiftFits($shift)) { $this->shifts[] = $shift; - return true; + return; } - return false; + throw new Exception('Unable to add shift to shift calendar lane.'); } /** -- cgit v1.2.3-54-g00ecf From 4effb7e59f1bba13230060481eb126548b5442ca Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 28 Jul 2017 19:28:11 +0200 Subject: fix lane rendering --- includes/view/ShiftCalendarLane.php | 3 +++ includes/view/ShiftCalendarRenderer.php | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'includes/view/ShiftCalendarLane.php') diff --git a/includes/view/ShiftCalendarLane.php b/includes/view/ShiftCalendarLane.php index 251b8013..fd4c6f06 100644 --- a/includes/view/ShiftCalendarLane.php +++ b/includes/view/ShiftCalendarLane.php @@ -2,6 +2,8 @@ namespace Engelsystem; +use Exception; + /** * Represents a single lane in a shifts calendar. */ @@ -38,6 +40,7 @@ class ShiftCalendarLane * Returns true on success. * * @param array $shift The shift to add + * @throws Exception if the shift doesn't fit into the lane. */ public function addShift($shift) { diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php index df24ad3b..3269f338 100644 --- a/includes/view/ShiftCalendarRenderer.php +++ b/includes/view/ShiftCalendarRenderer.php @@ -1,6 +1,8 @@ shiftFits($shift)) { $lane->addShift($shift); - } catch (Exception $e) { + $shift_added = true; break; } } -- cgit v1.2.3-54-g00ecf