Skip to content

Commit

Permalink
Merge pull request #230 from magicHatOfTYPO3/develop
Browse files Browse the repository at this point in the history
[BUGFIX] Return empty ObjectStorage instead of null
  • Loading branch information
einpraegsam authored Dec 12, 2024
2 parents 9239477 + 052c5ad commit 7a9d6b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Classes/Domain/Model/Usergroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Usergroup extends AbstractEntity
/**
* @var ObjectStorage<Usergroup>
*/
protected ObjectStorage $subgroup;
protected ?ObjectStorage $subgroup = null;

public function __construct(string $title = '')
{
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 7a9d6b9

Please sign in to comment.