From 127af4a5abcf7c4a19a10d2955d019b287ed24a0 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Tue, 16 May 2023 13:24:09 +0200 Subject: [PATCH] [TASK] Avoid object manager in post model --- Classes/Domain/Model/Post.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Classes/Domain/Model/Post.php b/Classes/Domain/Model/Post.php index 536231eb..1b66da67 100644 --- a/Classes/Domain/Model/Post.php +++ b/Classes/Domain/Model/Post.php @@ -17,7 +17,6 @@ use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder; -use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; class Post extends AbstractEntity @@ -375,8 +374,7 @@ public function getComments(): ObjectStorage */ public function getActiveComments() { - return GeneralUtility::makeInstance(ObjectManager::class) - ->get(CommentRepository::class) + return GeneralUtility::makeInstance(CommentRepository::class) ->findAllByPost($this); } @@ -542,8 +540,7 @@ public function getCrdateYear(): int */ public function getUri(): string { - return GeneralUtility::makeInstance(ObjectManager::class) - ->get(UriBuilder::class) + return GeneralUtility::makeInstance(UriBuilder::class) ->setCreateAbsoluteUri(true) ->setTargetPageUid($this->getUid()) ->build();