From abc1bc635403a452bc32e6cc768e81ee647e3a39 Mon Sep 17 00:00:00 2001 From: Daniel Subiabre Date: Tue, 10 Dec 2024 16:03:26 +0100 Subject: [PATCH] Handle null owner cases in accounting entity --- src/Entity/Accounting/Accounting.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Entity/Accounting/Accounting.php b/src/Entity/Accounting/Accounting.php index 39e0073..3bf5d75 100644 --- a/src/Entity/Accounting/Accounting.php +++ b/src/Entity/Accounting/Accounting.php @@ -91,10 +91,16 @@ class Accounting case Tipjar::class: return $this->getTipjar(); } + + return null; } - public function setOwner(AccountingOwnerInterface $owner): static + public function setOwner(?AccountingOwnerInterface $owner): static { + if ($owner === null) { + return $this; + } + $this->setOwnerClass($owner::class); switch ($this->getOwnerClass()) {