From dbd67c164a99724107b9ee99a82fe14eae81d4d0 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 14 Sep 2017 11:07:10 +0200 Subject: [PATCH] add null objects as return --- Models/Department.php | 4 ++-- Models/Position.php | 4 ++-- Models/Unit.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Models/Department.php b/Models/Department.php index 39c3d20..fa45dc7 100644 --- a/Models/Department.php +++ b/Models/Department.php @@ -45,7 +45,7 @@ class Department public function getParent() { - return $this->parent; + return $this->parent ?? new NullDepartment(); } public function setParent(int $parent) @@ -65,7 +65,7 @@ class Department public function getUnit() { - return $this->unit; + return $this->unit ?? new NullUnit(); } public function setUnit($unit) diff --git a/Models/Position.php b/Models/Position.php index ffc0145..5883ac6 100644 --- a/Models/Position.php +++ b/Models/Position.php @@ -47,7 +47,7 @@ class Position implements ArrayableInterface, \JsonSerializable public function getParent() { - return $this->parent; + return $this->parent ?? new NullPosition(); } public function setParent(int $parent) @@ -57,7 +57,7 @@ class Position implements ArrayableInterface, \JsonSerializable public function getDepartment() { - return $this->department; + return $this->department ?? new NullDepartment(); } public function setDepartment($department) diff --git a/Models/Unit.php b/Models/Unit.php index c6c63ab..8645416 100644 --- a/Models/Unit.php +++ b/Models/Unit.php @@ -45,7 +45,7 @@ class Unit implements ArrayableInterface, \JsonSerializable public function getParent() { - return $this->parent; + return $this->parent ?? new NullUnit(); } public function setParent(int $parent)