From 052c5ad3ed7e96e76f017e6d017b00fc3f362f3e Mon Sep 17 00:00:00 2001 From: magicHatOfTYPO3 Date: Thu, 12 Dec 2024 11:14:04 +0100 Subject: [PATCH] [BUGFIX] Return empty ObjectStorage instead of null --- Classes/Domain/Model/Usergroup.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/Domain/Model/Usergroup.php b/Classes/Domain/Model/Usergroup.php index 7b30eb7..a9ce872 100644 --- a/Classes/Domain/Model/Usergroup.php +++ b/Classes/Domain/Model/Usergroup.php @@ -17,7 +17,7 @@ class Usergroup extends AbstractEntity /** * @var ObjectStorage */ - protected ObjectStorage $subgroup; + protected ?ObjectStorage $subgroup = null; public function __construct(string $title = '') { @@ -67,6 +67,9 @@ public function removeSubgroup(Usergroup $subgroup): self public function getSubgroup(): ObjectStorage { + if ($this->subgroup === null) { + $this->subgroup = new ObjectStorage(); + } return $this->subgroup; }