From f97ab6e67d3f150cf1b932dc1aa4f9e08c432336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Thu, 25 Jan 2024 14:16:23 +0100 Subject: [PATCH 1/2] Fix category parent getter to handle lazy loading proxy objects --- Classes/Domain/Model/Category.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Classes/Domain/Model/Category.php b/Classes/Domain/Model/Category.php index 672299d4..72060148 100644 --- a/Classes/Domain/Model/Category.php +++ b/Classes/Domain/Model/Category.php @@ -88,6 +88,9 @@ public function setDescription(string $description): self public function getParent(): ?self { + if ($this->parent instanceof LazyLoadingProxy) { + $this->parent->_loadRealInstance(); + } return $this->parent; } From ab2c01c00902101a078fe42bd534eebd049af9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Thu, 25 Jan 2024 14:52:28 +0100 Subject: [PATCH 2/2] Add missing use statement for FQN of LazyLoadingProxy --- Classes/Domain/Model/Category.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Classes/Domain/Model/Category.php b/Classes/Domain/Model/Category.php index 72060148..529e54ef 100644 --- a/Classes/Domain/Model/Category.php +++ b/Classes/Domain/Model/Category.php @@ -13,6 +13,7 @@ use T3G\AgencyPack\Blog\Constants; use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; class Category extends AbstractEntity