From a25a51d48c41098b769132f3447b932aeb62e110 Mon Sep 17 00:00:00 2001 From: romanetar Date: Fri, 6 Mar 2026 16:10:35 +0100 Subject: [PATCH 1/2] fix: statistics getters default return value Signed-off-by: romanetar --- app/Models/Foundation/Summit/SponsorStatistics.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Models/Foundation/Summit/SponsorStatistics.php b/app/Models/Foundation/Summit/SponsorStatistics.php index a9f809c57..d723a20d8 100644 --- a/app/Models/Foundation/Summit/SponsorStatistics.php +++ b/app/Models/Foundation/Summit/SponsorStatistics.php @@ -74,7 +74,7 @@ public function clearSponsor(): void public function getFormsQty(): int { - return $this->formsQty; + return $this->formsQty ?? 0; } public function setFormsQty(int $formsQty): void @@ -84,7 +84,7 @@ public function setFormsQty(int $formsQty): void public function getPurchasesQty(): int { - return $this->purchasesQty; + return $this->purchasesQty ?? 0; } public function setPurchasesQty(int $purchasesQty): void @@ -94,7 +94,7 @@ public function setPurchasesQty(int $purchasesQty): void public function getPagesQty(): int { - return $this->pagesQty; + return $this->pagesQty ?? 0; } public function setPagesQty(int $pagesQty): void @@ -104,7 +104,7 @@ public function setPagesQty(int $pagesQty): void public function getDocumentsQty(): int { - return $this->documentsQty; + return $this->documentsQty ?? 0; } public function setDocumentsQty(int $documentsQty): void From cc1081ed9a9b85fc5e4e618dc8546c76046e44d1 Mon Sep 17 00:00:00 2001 From: romanetar Date: Fri, 6 Mar 2026 16:42:41 +0100 Subject: [PATCH 2/2] fix: statistics fields initialization Signed-off-by: romanetar --- .../Foundation/Summit/SponsorStatistics.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/Models/Foundation/Summit/SponsorStatistics.php b/app/Models/Foundation/Summit/SponsorStatistics.php index d723a20d8..6557b55b7 100644 --- a/app/Models/Foundation/Summit/SponsorStatistics.php +++ b/app/Models/Foundation/Summit/SponsorStatistics.php @@ -57,6 +57,15 @@ class SponsorStatistics extends SilverstripeBaseModel #[ORM\Column(name: 'DocumentsQty', type: 'integer')] private $documentsQty; + public function __construct() + { + parent::__construct(); + $this->formsQty = 0; + $this->purchasesQty = 0; + $this->pagesQty = 0; + $this->documentsQty = 0; + } + public function getSponsor(): Sponsor { return $this->sponsor; @@ -74,7 +83,7 @@ public function clearSponsor(): void public function getFormsQty(): int { - return $this->formsQty ?? 0; + return $this->formsQty; } public function setFormsQty(int $formsQty): void @@ -84,7 +93,7 @@ public function setFormsQty(int $formsQty): void public function getPurchasesQty(): int { - return $this->purchasesQty ?? 0; + return $this->purchasesQty; } public function setPurchasesQty(int $purchasesQty): void @@ -94,7 +103,7 @@ public function setPurchasesQty(int $purchasesQty): void public function getPagesQty(): int { - return $this->pagesQty ?? 0; + return $this->pagesQty; } public function setPagesQty(int $pagesQty): void @@ -104,7 +113,7 @@ public function setPagesQty(int $pagesQty): void public function getDocumentsQty(): int { - return $this->documentsQty ?? 0; + return $this->documentsQty; } public function setDocumentsQty(int $documentsQty): void